From 925d8b5315b6323cf067f32348d5e93fffa1959d Mon Sep 17 00:00:00 2001 From: Daniel Vaz Gaspar Date: Tue, 14 Apr 2020 10:10:14 +0100 Subject: [PATCH] [dashboard] Fix, improve test for custom filter (#9521) --- tests/dashboards/api_tests.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/dashboards/api_tests.py b/tests/dashboards/api_tests.py index 1d2241e089..ced4b3daca 100644 --- a/tests/dashboards/api_tests.py +++ b/tests/dashboards/api_tests.py @@ -192,7 +192,9 @@ class DashboardApiTests(SupersetTestCase, ApiOwnersTestCaseMixin): arguments = { "filters": [ {"col": "dashboard_title", "opr": "title_or_slug", "value": "zy_"} - ] + ], + "order_column": "dashboard_title", + "order_direction": "asc", } self.login(username="admin") uri = f"api/v1/dashboard/?q={prison.dumps(arguments)}" @@ -201,6 +203,17 @@ class DashboardApiTests(SupersetTestCase, ApiOwnersTestCaseMixin): data = json.loads(rv.data.decode("utf-8")) self.assertEqual(data["count"], 3) + expected_response = [ + {"slug": "ZY_bar", "dashboard_title": "foo",}, + {"slug": "slug1zy_", "dashboard_title": "foo",}, + {"slug": "slug1", "dashboard_title": "zy_foo",}, + ] + for index, item in enumerate(data["result"]): + self.assertEqual(item["slug"], expected_response[index]["slug"]) + self.assertEqual( + item["dashboard_title"], expected_response[index]["dashboard_title"] + ) + self.logout() self.login(username="gamma") uri = f"api/v1/dashboard/?q={prison.dumps(arguments)}"