From 7c7e81b51988980b5fae01af0a43e97541406641 Mon Sep 17 00:00:00 2001 From: tim-s-ccs Date: Mon, 19 Aug 2024 14:01:00 +0100 Subject: [PATCH] Add page to allow pagination --- dmapiclient/__init__.py | 2 +- dmapiclient/data.py | 7 +++++-- tests/test_data_api_client.py | 11 +++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dmapiclient/__init__.py b/dmapiclient/__init__.py index 0adb00d..18173c6 100644 --- a/dmapiclient/__init__.py +++ b/dmapiclient/__init__.py @@ -1,4 +1,4 @@ -__version__ = '26.6.0' +__version__ = '26.6.1' from .errors import APIError, HTTPError, InvalidResponse # noqa from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa diff --git a/dmapiclient/data.py b/dmapiclient/data.py index 8956cf2..1036bdc 100644 --- a/dmapiclient/data.py +++ b/dmapiclient/data.py @@ -1574,9 +1574,12 @@ def find_evaluator_questions( find_evaluator_questions_iter = make_iter_method('find_evaluator_questions', 'evaluatorQuestions') find_evaluator_questions_iter.__name__ = str("find_evaluator_questions_iter") - def find_evaluator_question_users(self, framework, lot): + def find_evaluator_question_users(self, framework, lot, page=None): return self._get( - f"/evaluator-questions/{framework}/{lot}/users" + f"/evaluator-questions/{framework}/{lot}/users", + params={ + 'page': page + } ) def get_evaluator_question(self, evaluator_question_id): diff --git a/tests/test_data_api_client.py b/tests/test_data_api_client.py index d840475..044c4bc 100644 --- a/tests/test_data_api_client.py +++ b/tests/test_data_api_client.py @@ -4034,6 +4034,17 @@ def test_find_evaluator_question_users_response(self, data_client, rmock): assert result == {"usersWithEvaluatorQuestions": "result"} assert rmock.called + def test_find_evaluator_question_users_adds_page_parameter(self, data_client, rmock): + rmock.get( + "http://baseurl/evaluator-questions/g-cloud-6/g-things/users?page=2", + json={"usersWithEvaluatorQuestions": "result"}, + status_code=200) + + result = data_client.find_evaluator_question_users('g-cloud-6', 'g-things', page=2) + + assert result == {"usersWithEvaluatorQuestions": "result"} + assert rmock.called + def test_get_lot_questions_response(self, data_client, rmock): rmock.get( "http://baseurl/evaluator-questions/1234",