Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion tests/dashboards/api_tests.py
Original file line number Diff line number Diff line change
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