Skip to content

Commit

Permalink
add test for tab state (#20949)
Browse files Browse the repository at this point in the history
  • Loading branch information
eschutho authored Aug 10, 2022
1 parent ab6ec89 commit 7445eab
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/integration_tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1468,6 +1468,38 @@ def test_sqllab_backend_persistence_payload(self):
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()
Expand Down

0 comments on commit 7445eab

Please sign in to comment.