refactor: Changes the DatabaseSelector and TableSelector to use the new Select component (#16483)

This commit is contained in:
Michael S. Molina
2021-09-22 07:43:46 -03:00
committed by GitHub
parent 1d5100daa2
commit 596e1cdf9b
18 changed files with 738 additions and 874 deletions

View File

@@ -221,6 +221,7 @@ class TestDatasetApi(SupersetTestCase):
Dataset API: Test get dataset item
"""
table = self.get_energy_usage_dataset()
main_db = get_main_database()
self.login(username="admin")
uri = f"api/v1/dataset/{table.id}"
rv = self.get_assert_metric(uri, "get")
@@ -228,7 +229,11 @@ class TestDatasetApi(SupersetTestCase):
response = json.loads(rv.data.decode("utf-8"))
expected_result = {
"cache_timeout": None,
"database": {"database_name": "examples", "id": 1},
"database": {
"backend": main_db.backend,
"database_name": "examples",
"id": 1,
},
"default_endpoint": None,
"description": "Energy consumption",
"extra": None,
@@ -243,9 +248,10 @@ class TestDatasetApi(SupersetTestCase):
"table_name": "energy_usage",
"template_params": None,
}
assert {
k: v for k, v in response["result"].items() if k in expected_result
} == expected_result
if response["result"]["database"]["backend"] not in ("presto", "hive"):
assert {
k: v for k, v in response["result"].items() if k in expected_result
} == expected_result
assert len(response["result"]["columns"]) == 3
assert len(response["result"]["metrics"]) == 2