From 3e6b37bf55740b1da79ff5f3f38abb6bceebfc7f Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 15 May 2022 02:35:06 +0200 Subject: [PATCH] Add test without simple_response --- InvenTree/plugin/base/integration/test_mixins.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/InvenTree/plugin/base/integration/test_mixins.py b/InvenTree/plugin/base/integration/test_mixins.py index d3912a355a..4ce4455706 100644 --- a/InvenTree/plugin/base/integration/test_mixins.py +++ b/InvenTree/plugin/base/integration/test_mixins.py @@ -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