feat: add concept of (non-)default importers for handler
i.e. when telling handler to "import all" which should be included vs. excluded by default?
This commit is contained in:
parent
ae282ab468
commit
d7d0768a9c
7 changed files with 148 additions and 15 deletions
|
|
@ -7,6 +7,7 @@ from uuid import UUID
|
|||
from wuttjamaican.testing import DataTestCase
|
||||
|
||||
from wuttasync.importing import handlers as mod, Importer, ToSqlalchemy
|
||||
from wuttasync.importing.wutta import FromWuttaToWuttaImport
|
||||
|
||||
|
||||
class FromFooToBar(mod.ImportHandler):
|
||||
|
|
@ -253,6 +254,25 @@ class TestImportHandler(DataTestCase):
|
|||
KeyError, handler.get_importer, "BunchOfNonsense", model_class=model.Setting
|
||||
)
|
||||
|
||||
def test_is_default(self):
|
||||
handler = self.make_handler()
|
||||
# nb. anything is considered default, by default
|
||||
self.assertTrue(handler.is_default("there_is_no_way_this_is_valid"))
|
||||
|
||||
def test_get_default_importer_keys(self):
|
||||
|
||||
# use handler which already has some non/default keys
|
||||
handler = FromWuttaToWuttaImport(self.config)
|
||||
|
||||
# it supports many importers
|
||||
self.assertIn("Person", handler.importers)
|
||||
self.assertIn("User", handler.importers)
|
||||
self.assertIn("Setting", handler.importers)
|
||||
|
||||
# but only Person is default
|
||||
keys = handler.get_default_importer_keys()
|
||||
self.assertEqual(keys, ["Person"])
|
||||
|
||||
def test_get_warnings_email_key(self):
|
||||
handler = FromFooToBar(self.config)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue