kopia lustrzana https://github.com/wagtail/wagtail
Rename operations_and_block_path identifiers for consistency
rodzic
3949026270
commit
8fbd74a2f0
|
@ -10,7 +10,7 @@ class MigrationTestMixin:
|
|||
default_operation_and_block_path = []
|
||||
app_name = None
|
||||
|
||||
def init_migration(self, revisions_from=None, operations_and_block_path=None):
|
||||
def init_migration(self, revisions_from=None, operations_and_block_paths=None):
|
||||
migration = Migration(
|
||||
"test_migration", "wagtail_streamfield_migration_toolkit_test"
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ class MigrationTestMixin:
|
|||
app_name=self.app_name,
|
||||
model_name=self.model.__name__,
|
||||
field_name="content",
|
||||
operations_and_block_paths=operations_and_block_path
|
||||
operations_and_block_paths=operations_and_block_paths
|
||||
or self.default_operation_and_block_path,
|
||||
revisions_from=revisions_from,
|
||||
)
|
||||
|
@ -29,11 +29,11 @@ class MigrationTestMixin:
|
|||
def apply_migration(
|
||||
self,
|
||||
revisions_from=None,
|
||||
operations_and_block_path=None,
|
||||
operations_and_block_paths=None,
|
||||
):
|
||||
migration = self.init_migration(
|
||||
revisions_from=revisions_from,
|
||||
operations_and_block_path=operations_and_block_path,
|
||||
operations_and_block_paths=operations_and_block_paths,
|
||||
)
|
||||
|
||||
loader = MigrationLoader(connection=connection)
|
||||
|
|
|
@ -13,35 +13,35 @@ class MigrationNameTest(TestCase, MigrationTestMixin):
|
|||
app_name = "wagtail_streamfield_migration_toolkit_test"
|
||||
|
||||
def test_rename(self):
|
||||
operations_and_block_path = [
|
||||
operations_and_block_paths = [
|
||||
(
|
||||
RenameStreamChildrenOperation(old_name="char1", new_name="renamed1"),
|
||||
"",
|
||||
)
|
||||
]
|
||||
migration = self.init_migration(
|
||||
operations_and_block_path=operations_and_block_path
|
||||
operations_and_block_paths=operations_and_block_paths
|
||||
)
|
||||
|
||||
suggested_name = migration.suggest_name()
|
||||
self.assertEqual(suggested_name, "rename_char1_to_renamed1")
|
||||
|
||||
def test_remove(self):
|
||||
operations_and_block_path = [
|
||||
operations_and_block_paths = [
|
||||
(
|
||||
RemoveStreamChildrenOperation(name="char1"),
|
||||
"",
|
||||
)
|
||||
]
|
||||
migration = self.init_migration(
|
||||
operations_and_block_path=operations_and_block_path
|
||||
operations_and_block_paths=operations_and_block_paths
|
||||
)
|
||||
|
||||
suggested_name = migration.suggest_name()
|
||||
self.assertEqual(suggested_name, "remove_char1")
|
||||
|
||||
def test_multiple(self):
|
||||
operations_and_block_path = [
|
||||
operations_and_block_paths = [
|
||||
(
|
||||
RenameStreamChildrenOperation(old_name="char1", new_name="renamed1"),
|
||||
"",
|
||||
|
@ -52,7 +52,7 @@ class MigrationNameTest(TestCase, MigrationTestMixin):
|
|||
),
|
||||
]
|
||||
migration = self.init_migration(
|
||||
operations_and_block_path=operations_and_block_path
|
||||
operations_and_block_paths=operations_and_block_paths
|
||||
)
|
||||
|
||||
suggested_name = migration.suggest_name()
|
||||
|
|
|
@ -278,7 +278,7 @@ class StreamChildrenToListBlockOperationTestCase(BaseMigrationTest):
|
|||
"""
|
||||
|
||||
self.apply_migration(
|
||||
operations_and_block_path=[
|
||||
operations_and_block_paths=[
|
||||
(
|
||||
StreamChildrenToListBlockOperation(
|
||||
block_name="char1", list_block_name="list1"
|
||||
|
|
Ładowanie…
Reference in New Issue