feat: route bounded hierarchy postbox copies
This commit is contained in:
@@ -14,14 +14,21 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
"govoplan_postbox.backend.migrations.versions."
|
||||
"c7d2e5f8a1b4_v010_postbox_baseline"
|
||||
)
|
||||
route_migration = importlib.import_module(
|
||||
"govoplan_postbox.backend.migrations.versions."
|
||||
"e4b7c9d2a6f1_v011_hierarchy_routes"
|
||||
)
|
||||
engine = create_engine("sqlite:///:memory:")
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
operations = Operations(MigrationContext.configure(connection))
|
||||
original = migration.op
|
||||
route_original = route_migration.op
|
||||
migration.op = operations
|
||||
route_migration.op = operations
|
||||
try:
|
||||
migration.upgrade()
|
||||
route_migration.upgrade()
|
||||
tables = set(inspect(connection).get_table_names())
|
||||
self.assertIn("postboxes", tables)
|
||||
self.assertIn("postbox_messages", tables)
|
||||
@@ -43,6 +50,18 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
"withdrawn_at",
|
||||
}.issubset(message_columns)
|
||||
)
|
||||
route_columns = {
|
||||
column["name"]
|
||||
for column in inspect(connection).get_columns(
|
||||
"postbox_routes"
|
||||
)
|
||||
}
|
||||
self.assertTrue(
|
||||
{"execute_after", "processed_at"}.issubset(
|
||||
route_columns
|
||||
)
|
||||
)
|
||||
route_migration.downgrade()
|
||||
migration.downgrade()
|
||||
self.assertFalse(
|
||||
{
|
||||
@@ -53,6 +72,7 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
)
|
||||
finally:
|
||||
migration.op = original
|
||||
route_migration.op = route_original
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user