feat: add support for Wutta <-> Wutta import/export
This commit is contained in:
parent
bfc45bd0f0
commit
ae282ab468
25 changed files with 719 additions and 21 deletions
|
|
@ -46,6 +46,18 @@ class TestWuttaSyncAppProvider(ConfigTestCase):
|
|||
self.assertIn(FromCsvToWutta, handlers)
|
||||
self.assertIn(FromFooToBar, handlers)
|
||||
|
||||
# now for something completely different..here we pretend there
|
||||
# are multiple handler entry points with same key. all should
|
||||
# be returned, including both which share the key.
|
||||
entry_points = {
|
||||
"import.to_baz.from_foo": [FromFooToBaz1, FromFooToBaz2],
|
||||
}
|
||||
with patch.object(mod, "load_entry_points", return_value=entry_points):
|
||||
handlers = self.app.get_all_import_handlers()
|
||||
self.assertEqual(len(handlers), 2)
|
||||
self.assertIn(FromFooToBaz1, handlers)
|
||||
self.assertIn(FromFooToBaz2, handlers)
|
||||
|
||||
def test_get_designated_import_handler_spec(self):
|
||||
|
||||
# fetch of unknown key returns none
|
||||
|
|
@ -139,6 +151,14 @@ class TestWuttaSyncAppProvider(ConfigTestCase):
|
|||
handler = self.app.get_import_handler("import.to_wutta.from_csv")
|
||||
self.assertIsInstance(handler, FromCsvToWutta)
|
||||
self.assertIsInstance(handler, FromCsvToPoser)
|
||||
self.assertFalse(hasattr(handler, "foo_attr"))
|
||||
|
||||
# can pass extra kwargs
|
||||
handler = self.app.get_import_handler(
|
||||
"import.to_wutta.from_csv", foo_attr="whatever"
|
||||
)
|
||||
self.assertTrue(hasattr(handler, "foo_attr"))
|
||||
self.assertEqual(handler.foo_attr, "whatever")
|
||||
|
||||
# unknown importer cannot be found
|
||||
handler = self.app.get_import_handler("bogus")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue