test: birth names (#12226)

* add birth names fixture

* fix birth names related tests

* fix test_import_v0_dataset_cli_export columns order

* fix celery tests drop table

* fix mysql datetime type

* fix mysql typo in charts/api_tests

* refactor

* add licence

* fix use fixture for presto

* fix presto, hive query

* fix flaky metadata

* fix mysql bigint type

* fix run query

* fix hive datatype in metadata

* fix slice owner for cypress

* refactor num_boys num_girls

* fix is_dttm column

* debug logging

* fix query offset

* fix presto ds type in metadata

* fix presto ds type

* clean up debug logging
This commit is contained in:
Karol Kostrzewa
2021-01-11 14:57:55 +01:00
committed by GitHub
parent ff7b789931
commit 2ab490a101
26 changed files with 695 additions and 207 deletions

View File

@@ -14,6 +14,8 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
import pytest
from superset import db
from superset.charts.schemas import ChartDataQueryContextSchema
from superset.connectors.connector_registry import ConnectorRegistry
@@ -25,6 +27,7 @@ from superset.utils.core import (
TimeRangeEndpoint,
)
from tests.base_tests import SupersetTestCase
from tests.fixtures.birth_names_dashboard import load_birth_names_dashboard_with_slices
from tests.fixtures.query_context import get_query_context
@@ -141,7 +144,7 @@ class TestQueryContext(SupersetTestCase):
self.login(username="admin")
adhoc_metric = {
"expressionType": "SIMPLE",
"column": {"column_name": "sum_boys", "type": "BIGINT(20)"},
"column": {"column_name": "num_boys", "type": "BIGINT(20)"},
"aggregate": "SUM",
"label": "Boys",
"optionName": "metric_11",
@@ -166,6 +169,7 @@ class TestQueryContext(SupersetTestCase):
self.assertEqual(query_object.granularity, "timecol")
self.assertIn("having_druid", query_object.extras)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_csv_response_format(self):
"""
Ensure that CSV result format works
@@ -224,6 +228,7 @@ class TestQueryContext(SupersetTestCase):
query_payload = query_context.get_payload()
assert query_payload["queries"][0].get("error") is not None
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_samples_response_type(self):
"""
Ensure that samples result type works
@@ -240,6 +245,7 @@ class TestQueryContext(SupersetTestCase):
self.assertEqual(len(data), 5)
self.assertNotIn("sum__num", data[0])
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_query_response_type(self):
"""
Ensure that query result type works