Add Postbox message authoring and concurrency
This commit is contained in:
@@ -18,17 +18,24 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
"govoplan_postbox.backend.migrations.versions."
|
||||
"e4b7c9d2a6f1_v011_hierarchy_routes"
|
||||
)
|
||||
occ_migration = importlib.import_module(
|
||||
"govoplan_postbox.backend.migrations.versions."
|
||||
"f5c8d0e3b7a2_v012_authoring_and_occ"
|
||||
)
|
||||
engine = create_engine("sqlite:///:memory:")
|
||||
try:
|
||||
with engine.begin() as connection:
|
||||
operations = Operations(MigrationContext.configure(connection))
|
||||
original = migration.op
|
||||
route_original = route_migration.op
|
||||
occ_original = occ_migration.op
|
||||
migration.op = operations
|
||||
route_migration.op = operations
|
||||
occ_migration.op = operations
|
||||
try:
|
||||
migration.upgrade()
|
||||
route_migration.upgrade()
|
||||
occ_migration.upgrade()
|
||||
tables = set(inspect(connection).get_table_names())
|
||||
self.assertIn("postboxes", tables)
|
||||
self.assertIn("postbox_messages", tables)
|
||||
@@ -50,6 +57,21 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
"withdrawn_at",
|
||||
}.issubset(message_columns)
|
||||
)
|
||||
self.assertIn("authoring_key", message_columns)
|
||||
for table_name in (
|
||||
"postbox_templates",
|
||||
"postboxes",
|
||||
"postbox_groupings",
|
||||
):
|
||||
self.assertIn(
|
||||
"resource_revision",
|
||||
{
|
||||
column["name"]
|
||||
for column in inspect(connection).get_columns(
|
||||
table_name
|
||||
)
|
||||
},
|
||||
)
|
||||
route_columns = {
|
||||
column["name"]
|
||||
for column in inspect(connection).get_columns(
|
||||
@@ -61,6 +83,7 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
route_columns
|
||||
)
|
||||
)
|
||||
occ_migration.downgrade()
|
||||
route_migration.downgrade()
|
||||
migration.downgrade()
|
||||
self.assertFalse(
|
||||
@@ -73,6 +96,7 @@ class PostboxMigrationTests(unittest.TestCase):
|
||||
finally:
|
||||
migration.op = original
|
||||
route_migration.op = route_original
|
||||
occ_migration.op = occ_original
|
||||
finally:
|
||||
engine.dispose()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user