From d5c6534b1d1003b33b68bfda5856b56e6735c56d Mon Sep 17 00:00:00 2001 From: andrey-canon Date: Mon, 29 Jul 2024 13:01:09 -0500 Subject: [PATCH] chore: add kwargs parameter to client methods --- eox_nelp/api_clients/pearson_engine.py | 10 ++++++---- eox_nelp/api_clients/tests/test_pearson_engine.py | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eox_nelp/api_clients/pearson_engine.py b/eox_nelp/api_clients/pearson_engine.py index 0e28bb87..016cb430 100644 --- a/eox_nelp/api_clients/pearson_engine.py +++ b/eox_nelp/api_clients/pearson_engine.py @@ -82,7 +82,7 @@ def _get_exam_data(self, exam_id): "external_key": exam_id, } - def import_candidate_demographics(self, user): + def import_candidate_demographics(self, user, **kwargs): """ Import candidate demographics into Pearson Engine. @@ -97,11 +97,12 @@ def import_candidate_demographics(self, user): candidate = { "user_data": self._get_user_data(user), "platform_data": self._get_platform_data(), + **kwargs } return self.make_post(path, candidate) - def import_exam_authorization(self, user, exam_id, transaction_type="Add"): + def import_exam_authorization(self, user, exam_id, **kwargs): """ Import exam authorization data into Pearson Engine. @@ -116,12 +117,12 @@ def import_exam_authorization(self, user, exam_id, transaction_type="Add"): exam_data = { "user_data": {"username": user.username}, "exam_data": self._get_exam_data(exam_id), - "transaction_type": transaction_type, + **kwargs } return self.make_post(path, exam_data) - def real_time_import(self, user, exam_id): + def real_time_import(self, user, exam_id, **kwargs): """ Perform a real-time import of exam authorization data. @@ -137,6 +138,7 @@ def real_time_import(self, user, exam_id): "user_data": self._get_user_data(user), "exam_data": self._get_exam_data(exam_id), "platform_data": self._get_platform_data(), + **kwargs } return self.make_post(path, data) diff --git a/eox_nelp/api_clients/tests/test_pearson_engine.py b/eox_nelp/api_clients/tests/test_pearson_engine.py index 3db7c043..c7495124 100644 --- a/eox_nelp/api_clients/tests/test_pearson_engine.py +++ b/eox_nelp/api_clients/tests/test_pearson_engine.py @@ -82,7 +82,7 @@ def test_import_exam_authorization(self, auth_mock, post_mock): exam_id = "exam-123" api_client = self.api_class() - response = api_client.import_exam_authorization(user, exam_id) + response = api_client.import_exam_authorization(user, exam_id, transaction_type="Add") self.assertDictEqual(response, expected_value) post_mock.assert_called_with("rti/api/v1/exam-authorization/", {