mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
feat(sqllab): SPA migration (#25151)
This commit is contained in:
@@ -49,7 +49,6 @@ from superset.models.dashboard import Dashboard
|
||||
from superset.models.slice import Slice
|
||||
from superset.models.sql_lab import Query
|
||||
from superset.result_set import SupersetResultSet
|
||||
from superset.sqllab.utils import bootstrap_sqllab_data
|
||||
from superset.utils import core as utils
|
||||
from superset.utils.core import backend
|
||||
from superset.utils.database import get_example_database
|
||||
@@ -956,7 +955,6 @@ class TestCore(SupersetTestCase):
|
||||
dash_id = db.session.query(Dashboard.id).first()[0]
|
||||
tbl_id = self.table_ids.get("wb_health_population")
|
||||
urls = [
|
||||
"/superset/sqllab",
|
||||
"/superset/welcome",
|
||||
f"/superset/dashboard/{dash_id}/",
|
||||
"/superset/profile/",
|
||||
@@ -1161,6 +1159,25 @@ class TestCore(SupersetTestCase):
|
||||
resp = self.client.get("/superset/profile/")
|
||||
assert resp.status_code == 302
|
||||
|
||||
def test_redirect_new_sqllab(self):
|
||||
self.login(username="admin")
|
||||
resp = self.client.get(
|
||||
"/superset/sqllab?savedQueryId=1&testParams=2",
|
||||
follow_redirects=True,
|
||||
)
|
||||
assert resp.request.path == "/sqllab/"
|
||||
assert (
|
||||
resp.request.query_string.decode("utf-8") == "savedQueryId=1&testParams=2"
|
||||
)
|
||||
|
||||
resp = self.client.post("/superset/sqllab/")
|
||||
assert resp.status_code == 302
|
||||
|
||||
def test_redirect_new_sqllab_history(self):
|
||||
self.login(username="admin")
|
||||
resp = self.client.get("/superset/sqllab/history/")
|
||||
assert resp.status_code == 302
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -259,7 +259,7 @@ class TestSqlLab(SupersetTestCase):
|
||||
def test_sqllab_has_access(self):
|
||||
for username in ("admin", "gamma_sqllab"):
|
||||
self.login(username)
|
||||
for endpoint in ("/superset/sqllab/", "/superset/sqllab/history/"):
|
||||
for endpoint in ("/sqllab/", "/sqllab/history/"):
|
||||
resp = self.client.get(endpoint)
|
||||
self.assertEqual(200, resp.status_code)
|
||||
|
||||
@@ -267,7 +267,7 @@ class TestSqlLab(SupersetTestCase):
|
||||
|
||||
def test_sqllab_no_access(self):
|
||||
self.login("gamma")
|
||||
for endpoint in ("/superset/sqllab/", "/superset/sqllab/history/"):
|
||||
for endpoint in ("/sqllab/", "/sqllab/history/"):
|
||||
resp = self.client.get(endpoint)
|
||||
# Redirects to the main page
|
||||
self.assertEqual(302, resp.status_code)
|
||||
|
||||
Reference in New Issue
Block a user