[dashboard] Fix, improve test for custom filter (#9521)

This commit is contained in:
Daniel Vaz Gaspar 2020-04-14 10:10:14 +01:00 committed by GitHub
parent 9447381549
commit 925d8b5315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -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)}"