You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by dp...@apache.org on 2020/04/14 09:10:26 UTC

[incubator-superset] branch master updated: [dashboard] Fix, improve test for custom filter (#9521)

This is an automated email from the ASF dual-hosted git repository.

dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 925d8b5  [dashboard] Fix, improve test for custom filter (#9521)
925d8b5 is described below

commit 925d8b5315b6323cf067f32348d5e93fffa1959d
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Tue Apr 14 10:10:14 2020 +0100

    [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 1d2241e..ced4b3d 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)}"