chore: Update dataset_id & dataset_type datasource_id & datasource_type for SPA explore (#22461)

This commit is contained in:
Hugh A. Miles II
2022-12-22 19:46:00 -05:00
committed by GitHub
parent aa55800ca7
commit 9b26794419
13 changed files with 65 additions and 63 deletions

View File

@@ -112,7 +112,7 @@ def test_no_params_provided(test_client, login_as_admin):
def test_get_from_cache(test_client, login_as_admin, dataset):
resp = test_client.get(
f"api/v1/explore/?form_data_key={FORM_DATA_KEY}&dataset_id={dataset.id}&dataset_type={dataset.type}"
f"api/v1/explore/?form_data_key={FORM_DATA_KEY}&datasource_id={dataset.id}&datasource_type={dataset.type}"
)
assert resp.status_code == 200
data = json.loads(resp.data.decode("utf-8"))
@@ -146,7 +146,7 @@ def test_get_from_cache_unknown_key_chart_id(
def test_get_from_cache_unknown_key_dataset(test_client, login_as_admin, dataset):
unknown_key = "unknown_key"
resp = test_client.get(
f"api/v1/explore/?form_data_key={unknown_key}&dataset_id={dataset.id}&dataset_type={dataset.type}"
f"api/v1/explore/?form_data_key={unknown_key}&datasource_id={dataset.id}&datasource_type={dataset.type}"
)
assert resp.status_code == 200
data = json.loads(resp.data.decode("utf-8"))
@@ -204,15 +204,15 @@ def test_get_dataset_access_denied(
):
message = "Dataset access denied"
mock_can_access_datasource.side_effect = DatasetAccessDeniedError(
message=message, dataset_id=dataset.id, dataset_type=dataset.type
message=message, datasource_id=dataset.id, datasource_type=dataset.type
)
resp = test_client.get(
f"api/v1/explore/?form_data_key={FORM_DATA_KEY}&dataset_id={dataset.id}&dataset_type={dataset.type}"
f"api/v1/explore/?form_data_key={FORM_DATA_KEY}&datasource_id={dataset.id}&datasource_type={dataset.type}"
)
data = json.loads(resp.data.decode("utf-8"))
assert resp.status_code == 403
assert data["dataset_id"] == dataset.id
assert data["dataset_type"] == dataset.type
assert data["datasource_id"] == dataset.id
assert data["datasource_type"] == dataset.type
assert data["message"] == message
@@ -221,7 +221,7 @@ def test_wrong_endpoint(mock_get_datasource, test_client, login_as_admin, datase
dataset.default_endpoint = "another_endpoint"
mock_get_datasource.return_value = dataset
resp = test_client.get(
f"api/v1/explore/?dataset_id={dataset.id}&dataset_type={dataset.type}"
f"api/v1/explore/?datasource_id={dataset.id}&datasource_type={dataset.type}"
)
data = json.loads(resp.data.decode("utf-8"))
assert resp.status_code == 302