chore!: turn on Versioned Export in config.py (#19142)

* turning off versioned export

* deleted two tests that required version export false

* added tests

* test suggestions
This commit is contained in:
AAfghahi
2022-03-17 13:32:50 -04:00
committed by GitHub
parent 6593a727f2
commit c345029fbc
5 changed files with 17 additions and 34 deletions

View File

@@ -47,6 +47,9 @@ def assert_cli_fails_properly(response, caplog):
assert caplog.records[-1].levelname == "ERROR"
@mock.patch.dict(
"superset.cli.lib.feature_flags", {"VERSIONED_EXPORT": False}, clear=True
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_export_dashboards_original(app_context, fs):
"""
@@ -73,6 +76,9 @@ def test_export_dashboards_original(app_context, fs):
json.loads(contents)
@mock.patch.dict(
"superset.cli.lib.feature_flags", {"VERSIONED_EXPORT": False}, clear=True
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_export_datasources_original(app_context, fs):
"""
@@ -91,6 +97,7 @@ def test_export_datasources_original(app_context, fs):
)
assert response.exit_code == 0
assert Path("datasources.yaml").exists()
# check that file is valid JSON
@@ -336,7 +343,7 @@ def test_import_datasets_versioned_export(import_datasets_command, app_context,
@mock.patch.dict(
"superset.config.DEFAULT_FEATURE_FLAGS", {"VERSIONED_EXPORT": False}, clear=True
"superset.cli.lib.feature_flags", {"VERSIONED_EXPORT": False}, clear=True
)
@mock.patch("superset.datasets.commands.importers.v0.ImportDatasetsCommand")
def test_import_datasets_sync_argument_columns_metrics(
@@ -371,7 +378,7 @@ def test_import_datasets_sync_argument_columns_metrics(
@mock.patch.dict(
"superset.config.DEFAULT_FEATURE_FLAGS", {"VERSIONED_EXPORT": False}, clear=True
"superset.cli.lib.feature_flags", {"VERSIONED_EXPORT": False}, clear=True
)
@mock.patch("superset.datasets.commands.importers.v0.ImportDatasetsCommand")
def test_import_datasets_sync_argument_columns(
@@ -406,7 +413,7 @@ def test_import_datasets_sync_argument_columns(
@mock.patch.dict(
"superset.config.DEFAULT_FEATURE_FLAGS", {"VERSIONED_EXPORT": False}, clear=True
"superset.cli.lib.feature_flags", {"VERSIONED_EXPORT": False}, clear=True
)
@mock.patch("superset.datasets.commands.importers.v0.ImportDatasetsCommand")
def test_import_datasets_sync_argument_metrics(

View File

@@ -1331,6 +1331,11 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
db.session.delete(user_alpha2)
db.session.commit()
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": False},
clear=True,
)
@pytest.mark.usefixtures(
"load_world_bank_dashboard_with_slices",
"load_birth_names_dashboard_with_slices",
@@ -1376,11 +1381,6 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
db.session.delete(dashboard)
db.session.commit()
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": True},
clear=True,
)
def test_export_bundle(self):
"""
Dashboard API: Test dashboard export
@@ -1396,11 +1396,6 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
buf = BytesIO(rv.data)
assert is_zipfile(buf)
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": True},
clear=True,
)
def test_export_bundle_not_found(self):
"""
Dashboard API: Test dashboard export not found
@@ -1411,11 +1406,6 @@ class TestDashboardApi(SupersetTestCase, ApiOwnersTestCaseMixin, InsertChartMixi
rv = self.client.get(uri)
assert rv.status_code == 404
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": True},
clear=True,
)
def test_export_bundle_not_allowed(self):
"""
Dashboard API: Test dashboard export not allowed

View File

@@ -1455,11 +1455,6 @@ class TestDatasetApi(SupersetTestCase):
rv = self.client.get(uri)
assert rv.status_code == 200
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": True},
clear=True,
)
@pytest.mark.usefixtures("load_birth_names_dashboard_with_slices")
def test_export_dataset_bundle(self):
"""
@@ -1482,11 +1477,6 @@ class TestDatasetApi(SupersetTestCase):
buf = BytesIO(rv.data)
assert is_zipfile(buf)
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": True},
clear=True,
)
def test_export_dataset_bundle_not_found(self):
"""
Dataset API: Test export dataset not found
@@ -1499,11 +1489,6 @@ class TestDatasetApi(SupersetTestCase):
assert rv.status_code == 404
@patch.dict(
"superset.extensions.feature_flag_manager._feature_flags",
{"VERSIONED_EXPORT": True},
clear=True,
)
@pytest.mark.usefixtures("create_datasets")
def test_export_dataset_bundle_gamma(self):
"""