Skip to content

Commit

Permalink
search columns updated
Browse files Browse the repository at this point in the history
  • Loading branch information
AAfghahi committed Jul 16, 2021
1 parent ed4be29 commit 8954e1d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 49 deletions.
8 changes: 2 additions & 6 deletions superset/reports/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,9 @@ def ensure_alert_reports_enabled(self) -> Optional[Response]:
"created_by",
"type",
"last_state",
<<<<<<< HEAD
<<<<<<< HEAD
=======
"creation_method",
>>>>>>> Update superset/migrations/versions/3317e9248280_add_creation_method_to_reports_model.py
=======
>>>>>>> filters
"dashboard_id",
"chart_id",
]
search_filters = {"name": [ReportScheduleAllTextFilter]}
allowed_rel_fields = {"owners", "chart", "dashboard", "database", "created_by"}
Expand Down
6 changes: 1 addition & 5 deletions superset/reports/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@
)
creation_method_description = (
"Creation method is used to inform the frontend whether the report/alert was "
<<<<<<< HEAD
"created in the dashboard, chart, or alerts and reports UI."
=======
"created in the dashboard, charts, or alerts and reports UI."
>>>>>>> added logic for creation_method
)


Expand Down Expand Up @@ -163,7 +159,7 @@ class ReportSchedulePostSchema(Schema):
creation_method = EnumField(
ReportCreationMethodType,
by_value=True,
required=False,
required=True,
description=creation_method_description,
)
dashboard = fields.Integer(required=False, allow_none=True)
Expand Down
39 changes: 1 addition & 38 deletions tests/integration_tests/reports/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,7 @@ def test_create_report_schedule_relations_exist(self):
data = json.loads(rv.data.decode("utf-8"))
assert data == {"message": {"dashboard": "Dashboard does not exist"}}

@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")

# @pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
# TODO (AAfghahi): I am going to enable this when the report schedule feature is fully finished
# def test_create_report_schedule_no_creation_method(self):
# """
Expand Down Expand Up @@ -812,42 +811,6 @@ def test_create_report_schedule_relations_exist(self):
# }
# assert rv.status_code == 400

def test_create_report_schedule_no_creation_method(self):
"""
ReportSchedule Api: Test create report schedule
"""
self.login(username="admin")

chart = db.session.query(Slice).first()
example_db = get_example_database()
report_schedule_data = {
"type": ReportScheduleType.ALERT,
"name": "new3",
"description": "description",
"crontab": "0 9 * * *",
"recipients": [
{
"type": ReportRecipientType.EMAIL,
"recipient_config_json": {"target": "target@superset.org"},
},
{
"type": ReportRecipientType.SLACK,
"recipient_config_json": {"target": "channel"},
},
],
"grace_period": 14400,
"working_timeout": 3600,
"chart": chart.id,
"database": example_db.id,
}
uri = "api/v1/report/"
rv = self.client.post(uri, json=report_schedule_data)
response = json.loads(rv.data.decode("utf-8"))
assert response == {
"message": {"creation_method": ["Missing data for required field."]}
}
assert rv.status_code == 400

@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_create_report_schedule_invalid_creation_method(self):
"""
Expand Down

0 comments on commit 8954e1d

Please sign in to comment.