2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

added test for wrong config

This commit is contained in:
Matthias 2022-01-09 22:33:14 +01:00
parent e889f487f0
commit c8599039a2
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076

View File

@ -171,6 +171,11 @@ class APICallMixinTest(BaseMixinDefinition, TestCase):
''' '''
return self.api_call('api/users/2') return self.api_call('api/users/2')
self.mixin = MixinCls() self.mixin = MixinCls()
class WrongCLS(APICallMixin, IntegrationPluginBase):
pass
self.mixin_nothing = WrongCLS()
def test_function(self): def test_function(self):
# api_url # api_url
self.assertEqual('https://reqres.in', self.mixin.api_url) self.assertEqual('https://reqres.in', self.mixin.api_url)
@ -185,6 +190,10 @@ class APICallMixinTest(BaseMixinDefinition, TestCase):
self.assertTrue(result) self.assertTrue(result)
self.assertIn('data', result,) self.assertIn('data', result,)
# wrongly defined plugins should not load
with self.assertRaises(ValueError):
self.mixin_nothing.has_api_call()
class IntegrationPluginBaseTests(TestCase): class IntegrationPluginBaseTests(TestCase):
""" Tests for IntegrationPluginBase """ """ Tests for IntegrationPluginBase """