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

chore: add test for tab state #20949

Merged
merged 1 commit into from
Aug 10, 2022
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
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)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add payload
#21049

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