chore(key-value): convert command to dao (#29344)

This commit is contained in:
Ville Brofeldt
2024-07-01 20:22:11 +03:00
committed by GitHub
parent 0cf676b574
commit 7d6e933348
36 changed files with 867 additions and 1162 deletions

View File

@@ -133,11 +133,11 @@ class TestCreatePermalinkDataCommand(SupersetTestCase):
assert cache_data.get("datasource") == datasource
@patch("superset.security.manager.g")
@patch("superset.commands.key_value.get.GetKeyValueCommand.run")
@patch("superset.daos.key_value.KeyValueDAO.get_value")
@patch("superset.commands.explore.permalink.get.decode_permalink_id")
@pytest.mark.usefixtures("create_dataset", "create_slice")
def test_get_permalink_command_with_old_dataset_key(
self, decode_id_mock, get_kv_command_mock, mock_g
self, decode_id_mock, kv_get_value_mock, mock_g
):
mock_g.user = security_manager.find_user("admin")
app.config["EXPLORE_FORM_DATA_CACHE_CONFIG"] = {
@@ -149,13 +149,14 @@ class TestCreatePermalinkDataCommand(SupersetTestCase):
)
slice = db.session.query(Slice).filter_by(slice_name="slice_name").first()
datasource_string = f"{dataset.id}__{DatasourceType.TABLE}"
datasource_string = f"{dataset.id}__{DatasourceType.TABLE.value}"
decode_id_mock.return_value = "123456"
get_kv_command_mock.return_value = {
kv_get_value_mock.return_value = {
"chartId": slice.id,
"datasetId": dataset.id,
"datasource": datasource_string,
"datasourceType": DatasourceType.TABLE.value,
"state": {
"formData": {"datasource": datasource_string, "slice_id": slice.id}
},