You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by aa...@apache.org on 2022/08/10 20:45:37 UTC

[superset] branch master updated: add test for tab state (#20949)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7445eab5a2 add test for tab state (#20949)
7445eab5a2 is described below

commit 7445eab5a2def906ba623ad7d1ca75b771252573
Author: Elizabeth Thompson <es...@gmail.com>
AuthorDate: Wed Aug 10 13:45:31 2022 -0700

    add test for tab state (#20949)
---
 tests/integration_tests/core_tests.py | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/integration_tests/core_tests.py b/tests/integration_tests/core_tests.py
index 6bc08cae88..5c99a1e870 100644
--- a/tests/integration_tests/core_tests.py
+++ b/tests/integration_tests/core_tests.py
@@ -1468,6 +1468,38 @@ class TestCore(SupersetTestCase):
         payload = views.Superset._get_sqllab_tabs(user_id=user_id)
         self.assertEqual(len(payload["queries"]), 1)
 
+    @mock.patch.dict(
+        "superset.extensions.feature_flag_manager._feature_flags",
+        {"SQLLAB_BACKEND_PERSISTENCE": True},
+        clear=True,
+    )
+    def test_tabstate_with_name(self):
+        """
+        The tabstateview endpoint GET should be able to take name or title
+        for backward compatibility
+        """
+        username = "admin"
+        self.login(username)
+
+        # create a tab
+        data = {
+            "queryEditor": json.dumps(
+                {
+                    "name": "Untitled Query foo",
+                    "dbId": 1,
+                    "schema": None,
+                    "autorun": False,
+                    "sql": "SELECT ...",
+                    "queryLimit": 1000,
+                }
+            )
+        }
+        resp = self.get_json_resp("/tabstateview/", data=data)
+        tab_state_id = resp["id"]
+        payload = self.get_json_resp(f"/tabstateview/{tab_state_id}")
+
+        self.assertEqual(payload["label"], "Untitled Query foo")
+
     def test_virtual_table_explore_visibility(self):
         # test that default visibility it set to True
         database = superset.utils.database.get_example_database()