Skip to content

Commit

Permalink
fix python test
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Jan 5, 2023
1 parent 4859955 commit 318529e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions tests/integration_tests/queries/saved_queries/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def create_saved_queries(self):
self.insert_default_saved_query(
label=f"label{SAVED_QUERIES_FIXTURE_COUNT}",
schema=f"schema{SAVED_QUERIES_FIXTURE_COUNT}",
username="gamma",
username="gamma_sqllab",
)
)

Expand Down Expand Up @@ -157,12 +157,12 @@ def test_get_list_saved_query_gamma(self):
"""
Saved Query API: Test get list saved query
"""
gamma = self.get_user("gamma")
user = self.get_user("gamma_sqllab")
saved_queries = (
db.session.query(SavedQuery).filter(SavedQuery.created_by == gamma).all()
db.session.query(SavedQuery).filter(SavedQuery.created_by == user).all()
)

self.login(username="gamma")
self.login(username=user.username)
uri = f"api/v1/saved_query/"
rv = self.get_assert_metric(uri, "get_list")
assert rv.status_code == 200
Expand Down
8 changes: 2 additions & 6 deletions tests/integration_tests/sqllab_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,13 @@ def test_sql_json_has_access(self):
self.assertLess(0, len(data["data"]))

def test_sqllab_has_access(self):
self.create_user_with_roles("sqluser", ["Gamma", "sql_lab"])

for username in ("admin", "sqluser"):
for username in ("admin", "gamma_sqllab"):
self.login(username)
for endpoint in ("/superset/sqllab/", "/superset/sqllab/history/"):
resp = self.client.get(endpoint)
self.assertEqual(200, resp.status_code)

user = self.get_user("sqluser")
db.session.delete(user)
db.session.commit()
self.logout()

def test_sqllab_no_access(self):
self.login("gamma")
Expand Down

0 comments on commit 318529e

Please sign in to comment.