Skip to content

Commit

Permalink
chore: add kwargs parameter to client methods
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-canon committed Jul 29, 2024
1 parent d9114ea commit d5c6534
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions eox_nelp/api_clients/pearson_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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)
2 changes: 1 addition & 1 deletion eox_nelp/api_clients/tests/test_pearson_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/", {
Expand Down

0 comments on commit d5c6534

Please sign in to comment.