You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/11/18 11:45:27 UTC

[GitHub] [superset] villebro commented on a diff in pull request #22167: fix(alerts): execute query as report executor

villebro commented on code in PR #22167:
URL: https://github.com/apache/superset/pull/22167#discussion_r1026343330


##########
tests/integration_tests/reports/alert_tests.py:
##########
@@ -15,10 +15,80 @@
 # specific language governing permissions and limitations
 # under the License.
 # pylint: disable=invalid-name, unused-argument, import-outside-toplevel
+from contextlib import nullcontext
+from typing import List, Optional, Union
 
 import pandas as pd
+import pytest
 from pytest_mock import MockFixture
 
+from superset.reports.commands.exceptions import AlertQueryError
+from superset.reports.models import ReportCreationMethod, ReportScheduleType
+from superset.reports.types import ReportScheduleExecutor
+from superset.utils.database import get_example_database
+from tests.integration_tests.test_app import app
+
+
+@pytest.mark.parametrize(
+    "owner_names,creator_name,config,executor",
+    [
+        (["gamma"], None, [ReportScheduleExecutor.SELENIUM], "admin"),
+        (["gamma"], None, [ReportScheduleExecutor.OWNER], "gamma"),
+        (["alpha", "gamma"], "gamma", [ReportScheduleExecutor.CREATOR_OWNER], "gamma"),
+        (["alpha", "gamma"], "alpha", [ReportScheduleExecutor.CREATOR_OWNER], "alpha"),
+        (
+            ["alpha", "gamma"],
+            "admin",
+            [ReportScheduleExecutor.CREATOR_OWNER],
+            AlertQueryError(),
+        ),
+    ],
+)
+def test_execute_query_as_report_executor(
+    owner_names: List[str],
+    creator_name: Optional[str],
+    config: List[ReportScheduleExecutor],
+    executor: Union[str, Exception],

Review Comment:
   Good idea! 👍 



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org