feat: add support for --comment CLI param, to set versioning comment

only relevant if Wutta-Continuum is enabled
This commit is contained in:
Lance Edgar 2025-12-29 12:49:39 -06:00
parent 6ee008e169
commit e397890098
7 changed files with 49 additions and 38 deletions

View file

@ -198,6 +198,14 @@ class TestImportHandler(DataTestCase):
self.assertNotIn("runas_username", kw)
self.assertEqual(handler.runas_username, "fred")
# transaction_comment (consumed)
self.assertIsNone(handler.transaction_comment)
kw["transaction_comment"] = "hello world"
result = handler.consume_kwargs(kw)
self.assertIs(result, kw)
self.assertNotIn("transaction_comment", kw)
self.assertEqual(handler.transaction_comment, "hello world")
def test_define_importers(self):
handler = self.make_handler()
importers = handler.define_importers()

View file

@ -14,20 +14,6 @@ class TestFromWuttaToVersions(VersionTestCase):
def make_handler(self, **kwargs):
return mod.FromWuttaToVersions(self.config, **kwargs)
def test_consume_kwargs(self):
# no comment by default
handler = self.make_handler()
kw = handler.consume_kwargs({})
self.assertEqual(kw, {})
self.assertIsNone(handler.continuum_comment)
# but can provide one
handler = self.make_handler()
kw = handler.consume_kwargs({"comment": "yeehaw"})
self.assertEqual(kw, {})
self.assertEqual(handler.continuum_comment, "yeehaw")
def test_begin_target_transaction(self):
model = self.app.model
txncls = continuum.transaction_class(model.User)
@ -44,7 +30,7 @@ class TestFromWuttaToVersions(VersionTestCase):
# with comment
handler = self.make_handler()
handler.continuum_comment = "yeehaw"
handler.transaction_comment = "yeehaw"
handler.begin_target_transaction()
self.assertIn("comment", handler.continuum_txn.meta)
self.assertEqual(handler.continuum_txn.meta["comment"], "yeehaw")