Skip to content

Commit

Permalink
Merge pull request #130 from Crown-Commercial-Service/feature/DMP-685…
Browse files Browse the repository at this point in the history
…-add-group-by-user

Add page to allow pagination
  • Loading branch information
tim-s-ccs authored Aug 19, 2024
2 parents 9a5c416 + 7c7e81b commit 02cfd2e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dmapiclient/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 5 additions & 2 deletions dmapiclient/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
11 changes: 11 additions & 0 deletions tests/test_data_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 02cfd2e

Please sign in to comment.