diff --git a/scripts/tests/run.sh b/scripts/tests/run.sh index 6ba578d989513..24233010107dd 100755 --- a/scripts/tests/run.sh +++ b/scripts/tests/run.sh @@ -138,5 +138,5 @@ fi if [ $RUN_TESTS -eq 1 ] then - pytest --durations=0 --maxfail=10 "${TEST_MODULE}" + pytest --durations=0 --maxfail=1 "${TEST_MODULE}" fi diff --git a/superset/explore/form_data/commands/delete.py b/superset/explore/form_data/commands/delete.py index f11bcb90c4310..598ece3f080fc 100644 --- a/superset/explore/form_data/commands/delete.py +++ b/superset/explore/form_data/commands/delete.py @@ -59,11 +59,6 @@ def run(self) -> bool: contextual_key = cache_key( session.get("_id"), tab_id, datasource_id, chart_id, datasource_type ) - if contextual_key is None: - # check again with old keys - contextual_key = cache_key( - session.get("_id"), tab_id, datasource_id, chart_id - ) cache_manager.explore_form_data_cache.delete(contextual_key) return cache_manager.explore_form_data_cache.delete(key) return False diff --git a/superset/explore/form_data/commands/update.py b/superset/explore/form_data/commands/update.py index 2190b04da28e2..fdc75093bef85 100644 --- a/superset/explore/form_data/commands/update.py +++ b/superset/explore/form_data/commands/update.py @@ -67,11 +67,6 @@ def run(self) -> Optional[str]: contextual_key = cache_key( session.get("_id"), tab_id, datasource_id, chart_id, datasource_type ) - if contextual_key is None: - # check again with old keys - contextual_key = cache_key( - session.get("_id"), tab_id, datasource_id, chart_id - ) key = cache_manager.explore_form_data_cache.get(contextual_key) if not key or not tab_id: key = random_key() diff --git a/tests/integration_tests/explore/form_data/commands_tests.py b/tests/integration_tests/explore/form_data/commands_tests.py index c2c4c767f0c44..3d5a6679a4155 100644 --- a/tests/integration_tests/explore/form_data/commands_tests.py +++ b/tests/integration_tests/explore/form_data/commands_tests.py @@ -23,6 +23,7 @@ from superset.connectors.sqla.models import SqlaTable from superset.explore.form_data.commands.create import CreateFormDataCommand from superset.explore.form_data.commands.parameters import CommandParameters +from superset.explore.form_data.commands.update import UpdateFormDataCommand from superset.models.slice import Slice from superset.utils.core import DatasourceType, get_example_default_schema from superset.utils.database import get_example_database @@ -92,3 +93,38 @@ def test_create_form_data_command(self, mock_g): command = CreateFormDataCommand(args) assert isinstance(command.run(), str) + + +# TODO +# @patch("superset.security.manager.g") +# @pytest.mark.usefixtures("create_dataset", "create_slice") +# def test_update_form_data_command(self, mock_g): +# mock_g.user = security_manager.find_user("admin") + +# dataset = ( +# db.session.query(SqlaTable).filter_by( +# table_name="dummy_sql_table").first() +# ) +# slice = db.session.query(Slice).filter_by( +# slice_name="slice_name").first() +# create_args = CommandParameters( +# actor=mock_g.user, +# datasource_id=dataset.id, +# datasource_type=DatasourceType.TABLE, +# chart_id=slice.id, +# tab_id=1, +# form_data="", +# ) +# key = CreateFormDataCommand(create_args) +# update_args = CommandParameters( +# actor=mock_g.user, +# datasource_id=dataset.id, +# datasource_type=DatasourceType.TABLE, +# chart_id=slice.id, +# tab_id=1, +# form_data="", +# key=key +# ) +# command = UpdateFormDataCommand(update_args) + +# assert isinstance(command.run(), str)