chore(command): Organize Commands according to SIP-92 (#25850)

This commit is contained in:
John Bodley
2023-11-22 11:55:54 -08:00
committed by GitHub
parent 984c278c4c
commit 07bcfa9b5f
265 changed files with 786 additions and 808 deletions

View File

@@ -37,7 +37,7 @@ from tests.integration_tests.key_value.commands.fixtures import (
def test_create_id_entry(app_context: AppContext, admin: User) -> None:
from superset.key_value.commands.create import CreateKeyValueCommand
from superset.commands.key_value.create import CreateKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):
@@ -54,7 +54,7 @@ def test_create_id_entry(app_context: AppContext, admin: User) -> None:
def test_create_uuid_entry(app_context: AppContext, admin: User) -> None:
from superset.key_value.commands.create import CreateKeyValueCommand
from superset.commands.key_value.create import CreateKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):
@@ -69,7 +69,7 @@ def test_create_uuid_entry(app_context: AppContext, admin: User) -> None:
def test_create_fail_json_entry(app_context: AppContext, admin: User) -> None:
from superset.key_value.commands.create import CreateKeyValueCommand
from superset.commands.key_value.create import CreateKeyValueCommand
with pytest.raises(KeyValueCreateFailedError):
CreateKeyValueCommand(
@@ -80,7 +80,7 @@ def test_create_fail_json_entry(app_context: AppContext, admin: User) -> None:
def test_create_pickle_entry(app_context: AppContext, admin: User) -> None:
from superset.key_value.commands.create import CreateKeyValueCommand
from superset.commands.key_value.create import CreateKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):

View File

@@ -58,7 +58,7 @@ def test_delete_id_entry(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.delete import DeleteKeyValueCommand
from superset.commands.key_value.delete import DeleteKeyValueCommand
assert DeleteKeyValueCommand(resource=RESOURCE, key=ID_KEY).run() is True
@@ -68,7 +68,7 @@ def test_delete_uuid_entry(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.delete import DeleteKeyValueCommand
from superset.commands.key_value.delete import DeleteKeyValueCommand
assert DeleteKeyValueCommand(resource=RESOURCE, key=UUID_KEY).run() is True
@@ -78,6 +78,6 @@ def test_delete_entry_missing(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.delete import DeleteKeyValueCommand
from superset.commands.key_value.delete import DeleteKeyValueCommand
assert DeleteKeyValueCommand(resource=RESOURCE, key=456).run() is False

View File

@@ -38,7 +38,7 @@ if TYPE_CHECKING:
def test_get_id_entry(app_context: AppContext, key_value_entry: KeyValueEntry) -> None:
from superset.key_value.commands.get import GetKeyValueCommand
from superset.commands.key_value.get import GetKeyValueCommand
value = GetKeyValueCommand(resource=RESOURCE, key=ID_KEY, codec=JSON_CODEC).run()
assert value == JSON_VALUE
@@ -47,7 +47,7 @@ def test_get_id_entry(app_context: AppContext, key_value_entry: KeyValueEntry) -
def test_get_uuid_entry(
app_context: AppContext, key_value_entry: KeyValueEntry
) -> None:
from superset.key_value.commands.get import GetKeyValueCommand
from superset.commands.key_value.get import GetKeyValueCommand
value = GetKeyValueCommand(resource=RESOURCE, key=UUID_KEY, codec=JSON_CODEC).run()
assert value == JSON_VALUE
@@ -57,14 +57,14 @@ def test_get_id_entry_missing(
app_context: AppContext,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.get import GetKeyValueCommand
from superset.commands.key_value.get import GetKeyValueCommand
value = GetKeyValueCommand(resource=RESOURCE, key=456, codec=JSON_CODEC).run()
assert value is None
def test_get_expired_entry(app_context: AppContext) -> None:
from superset.key_value.commands.get import GetKeyValueCommand
from superset.commands.key_value.get import GetKeyValueCommand
from superset.key_value.models import KeyValueEntry
entry = KeyValueEntry(
@@ -83,7 +83,7 @@ def test_get_expired_entry(app_context: AppContext) -> None:
def test_get_future_expiring_entry(app_context: AppContext) -> None:
from superset.key_value.commands.get import GetKeyValueCommand
from superset.commands.key_value.get import GetKeyValueCommand
from superset.key_value.models import KeyValueEntry
id_ = 789

View File

@@ -45,7 +45,7 @@ def test_update_id_entry(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.update import UpdateKeyValueCommand
from superset.commands.key_value.update import UpdateKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):
@@ -67,7 +67,7 @@ def test_update_uuid_entry(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.update import UpdateKeyValueCommand
from superset.commands.key_value.update import UpdateKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):
@@ -85,7 +85,7 @@ def test_update_uuid_entry(
def test_update_missing_entry(app_context: AppContext, admin: User) -> None:
from superset.key_value.commands.update import UpdateKeyValueCommand
from superset.commands.key_value.update import UpdateKeyValueCommand
with override_user(admin):
key = UpdateKeyValueCommand(

View File

@@ -45,7 +45,7 @@ def test_upsert_id_entry(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.upsert import UpsertKeyValueCommand
from superset.commands.key_value.upsert import UpsertKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):
@@ -67,7 +67,7 @@ def test_upsert_uuid_entry(
admin: User,
key_value_entry: KeyValueEntry,
) -> None:
from superset.key_value.commands.upsert import UpsertKeyValueCommand
from superset.commands.key_value.upsert import UpsertKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):
@@ -85,7 +85,7 @@ def test_upsert_uuid_entry(
def test_upsert_missing_entry(app_context: AppContext, admin: User) -> None:
from superset.key_value.commands.upsert import UpsertKeyValueCommand
from superset.commands.key_value.upsert import UpsertKeyValueCommand
from superset.key_value.models import KeyValueEntry
with override_user(admin):