zhaoyongjie commented on code in PR #21765:
URL: https://github.com/apache/superset/pull/21765#discussion_r994319333


##########
tests/integration_tests/reports/api_tests.py:
##########
@@ -52,17 +53,67 @@
 
 class TestReportSchedulesApi(SupersetTestCase):
     @pytest.fixture()
-    def create_working_report_schedule(self):
+    def create_working_admin_report_schedule(self):
         with self.create_app().app_context():
 
             admin_user = self.get_user("admin")
+            chart = db.session.query(Slice).first()
+            example_db = get_example_database()
+
+            report_schedule = insert_report_schedule(
+                type=ReportScheduleType.ALERT,
+                name="name_admin_working",
+                crontab="* * * * *",
+                sql="SELECT value from table",
+                description="Report working",
+                chart=chart,
+                database=example_db,
+                owners=[admin_user],
+                last_state=ReportState.WORKING,
+            )
+
+            yield
+
+            db.session.delete(report_schedule)
+            db.session.commit()
+
+    @pytest.fixture()
+    def create_working_alpha_report_schedule(self):
+        with self.create_app().app_context():
+
             alpha_user = self.get_user("alpha")

Review Comment:
   there is a fixture called `login_as` might help for this case.



##########
tests/integration_tests/reports/api_tests.py:
##########
@@ -52,17 +53,67 @@
 
 class TestReportSchedulesApi(SupersetTestCase):
     @pytest.fixture()
-    def create_working_report_schedule(self):
+    def create_working_admin_report_schedule(self):
         with self.create_app().app_context():
 
             admin_user = self.get_user("admin")

Review Comment:
   one nit, in order to avoid extra indeed and context grammar, we should use 
`app_context` and `login_admin` fixtures
   
   ```python
   def create_working_report_schedule(app_context, login_admin):
       ....
       ....
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to