Add test without simple_response

This commit is contained in:
Matthias 2022-05-15 02:35:06 +02:00
parent 8c6061d3b7
commit 3e6b37bf55
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093

View File

@ -163,11 +163,11 @@ class APICallMixinTest(BaseMixinDefinition, TestCase):
API_URL_SETTING = 'API_URL'
API_TOKEN_SETTING = 'API_TOKEN'
def get_external_url(self):
def get_external_url(self, simple:bool = True):
'''
returns data from the sample endpoint
'''
return self.api_call('api/users/2')
return self.api_call('api/users/2', simple_response=simple)
self.mixin = MixinCls()
class WrongCLS(APICallMixin, InvenTreePlugin):
@ -204,6 +204,11 @@ class APICallMixinTest(BaseMixinDefinition, TestCase):
self.assertTrue(result)
self.assertIn('data', result,)
# api_call without response
result = self.mixin.get_external_url(False)
self.assertTrue(result)
self.assertEqual(result.reason, 'OK')
def test_function_errors(self):
"""Test function errors"""
# wrongly defined plugins should not load