Skip to content

Commit

Permalink
[dashboard] Fix, improve test for custom filter (#9521)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar committed Apr 14, 2020
1 parent 9447381 commit 925d8b5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/dashboards/api_tests.py
Expand Up @@ -192,7 +192,9 @@ def test_get_dashboards_custom_filter(self):
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)}"
Expand All @@ -201,6 +203,17 @@ def test_get_dashboards_custom_filter(self):
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)}"
Expand Down

0 comments on commit 925d8b5

Please sign in to comment.