From a89d82f1bda21f5c0f3ae88f6e1be0aa8c684067 Mon Sep 17 00:00:00 2001 From: nautics889 Date: Sun, 16 Apr 2023 19:42:48 +0300 Subject: [PATCH] fix: Failing test for getting custom fields (#114) Attempt to fix test cases `AppCustomFieldsTestCase` and `AppCustomFieldChoicesTestCase`. --- tests/test_app.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/test_app.py b/tests/test_app.py index fc6782b..f32db64 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -22,9 +22,12 @@ def test_custom_fields(self, session_get_mock): choices = api.extras.custom_fields() session_get_mock.assert_called_once() - expect_url = f"{api.base_url}/extras/custom-fields/" - url_passed_in_args = expect_url in session_get_mock.call_args.args - url_passed_in_kwargs = expect_url == session_get_mock.call_args.kwargs.get("url") + expect_location = "/custom-fields" + url_passed_in_args = url_passed_in_kwargs = False + if session_get_mock.call_args.args: + url_passed_in_args = expect_location in session_get_mock.call_args.args[0] + else: + url_passed_in_kwargs = expect_location in session_get_mock.call_args.kwargs.get("url", "") self.assertTrue(url_passed_in_args or url_passed_in_kwargs) self.assertIsInstance(choices, list) @@ -46,9 +49,12 @@ def test_custom_field_choices(self, session_get_mock): choices = api.extras.custom_field_choices() session_get_mock.assert_called_once() - expect_url = f"{api.base_url}/extras/custom-field-choices/" - url_passed_in_args = expect_url in session_get_mock.call_args.args - url_passed_in_kwargs = expect_url == session_get_mock.call_args.kwargs.get("url") + expect_location = "/custom-field-choices" + url_passed_in_args = url_passed_in_kwargs = False + if session_get_mock.call_args.args: + url_passed_in_args = expect_location in session_get_mock.call_args.args[0] + else: + url_passed_in_kwargs = expect_location in session_get_mock.call_args.kwargs.get("url", "") self.assertTrue(url_passed_in_args or url_passed_in_kwargs) self.assertIsInstance(choices, list)