mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
perf: Implement model specific lookups by id to improve performance (#20974)
* Implement model specific lookups by id to improve performance * Address comments e.g. better variable names and test cleanup * commit after cleanup * even better name and test cleanup via rollback Co-authored-by: Bogdan Kyryliuk <bogdankyryliuk@dropbox.com>
This commit is contained in:
@@ -126,7 +126,7 @@ def test_post_access_denied(
|
||||
"form_data": INITIAL_FORM_DATA,
|
||||
}
|
||||
resp = test_client.post("api/v1/explore/form_data", json=payload)
|
||||
assert resp.status_code == 404
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
def test_post_same_key_for_same_context(
|
||||
@@ -337,7 +337,7 @@ def test_put_access_denied(test_client, login_as, chart_id: int, datasource: Sql
|
||||
"form_data": UPDATED_FORM_DATA,
|
||||
}
|
||||
resp = test_client.put(f"api/v1/explore/form_data/{KEY}", json=payload)
|
||||
assert resp.status_code == 404
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
def test_put_not_owner(test_client, login_as, chart_id: int, datasource: SqlaTable):
|
||||
@@ -349,7 +349,7 @@ def test_put_not_owner(test_client, login_as, chart_id: int, datasource: SqlaTab
|
||||
"form_data": UPDATED_FORM_DATA,
|
||||
}
|
||||
resp = test_client.put(f"api/v1/explore/form_data/{KEY}", json=payload)
|
||||
assert resp.status_code == 404
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
def test_get_key_not_found(test_client, login_as_admin):
|
||||
@@ -367,7 +367,7 @@ def test_get(test_client, login_as_admin):
|
||||
def test_get_access_denied(test_client, login_as):
|
||||
login_as("gamma")
|
||||
resp = test_client.get(f"api/v1/explore/form_data/{KEY}")
|
||||
assert resp.status_code == 404
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
@patch("superset.security.SupersetSecurityManager.can_access_datasource")
|
||||
@@ -387,7 +387,7 @@ def test_delete(test_client, login_as_admin):
|
||||
def test_delete_access_denied(test_client, login_as):
|
||||
login_as("gamma")
|
||||
resp = test_client.delete(f"api/v1/explore/form_data/{KEY}")
|
||||
assert resp.status_code == 404
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
def test_delete_not_owner(
|
||||
|
||||
@@ -84,7 +84,7 @@ def test_post(
|
||||
def test_post_access_denied(test_client, login_as, form_data):
|
||||
login_as("gamma")
|
||||
resp = test_client.post(f"api/v1/explore/permalink", json={"formData": form_data})
|
||||
assert resp.status_code == 404
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
def test_get_missing_chart(
|
||||
|
||||
Reference in New Issue
Block a user