fix: fix 'duplicate-code' for pylint
This commit is contained in:
parent
da395e1880
commit
f86aeff788
5 changed files with 74 additions and 29 deletions
|
@ -761,6 +761,9 @@ class TestGenericHandler(ConfigTestCase):
|
|||
kw.setdefault('appname', 'wuttatest')
|
||||
return super().make_config(**kw)
|
||||
|
||||
def make_handler(self, **kwargs):
|
||||
return mod.GenericHandler(self.config, **kwargs)
|
||||
|
||||
def test_constructor(self):
|
||||
handler = mod.GenericHandler(self.config)
|
||||
self.assertIs(handler.config, self.config)
|
||||
|
@ -769,3 +772,30 @@ class TestGenericHandler(ConfigTestCase):
|
|||
|
||||
def test_get_spec(self):
|
||||
self.assertEqual(mod.GenericHandler.get_spec(), 'wuttjamaican.app:GenericHandler')
|
||||
|
||||
def test_get_provider_modules(self):
|
||||
|
||||
# no providers, no email modules
|
||||
with patch.object(self.app, 'providers', new={}):
|
||||
handler = self.make_handler()
|
||||
self.assertEqual(handler.get_provider_modules('email'), [])
|
||||
|
||||
# provider may specify modules as list
|
||||
providers = {
|
||||
'wuttatest': MagicMock(email_modules=['wuttjamaican.app']),
|
||||
}
|
||||
with patch.object(self.app, 'providers', new=providers):
|
||||
handler = self.make_handler()
|
||||
modules = handler.get_provider_modules('email')
|
||||
self.assertEqual(len(modules), 1)
|
||||
self.assertIs(modules[0], mod)
|
||||
|
||||
# provider may specify modules as string
|
||||
providers = {
|
||||
'wuttatest': MagicMock(email_modules='wuttjamaican.app'),
|
||||
}
|
||||
with patch.object(self.app, 'providers', new=providers):
|
||||
handler = self.make_handler()
|
||||
modules = handler.get_provider_modules('email')
|
||||
self.assertEqual(len(modules), 1)
|
||||
self.assertIs(modules[0], mod)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue