Skip to content

Commit

Permalink
Merge pull request #163 from Crown-Commercial-Service/add-api-methods…
Browse files Browse the repository at this point in the history
…-for-with-evaluations

Add `with_evaluations` to get_lot_question_response
  • Loading branch information
tim-s-ccs authored Dec 4, 2024
2 parents 78c4907 + f9ad21e commit 4f6cfc6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 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__ = '29.12.0'
__version__ = '29.12.1'

from .errors import APIError, HTTPError, InvalidResponse # noqa
from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa
Expand Down
11 changes: 7 additions & 4 deletions dmapiclient/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,12 @@ def create_lot_questions_response(self, supplier_id, framework_slug, lot_slug, u
user=user,
)

def get_lot_questions_response(self, lot_questions_response_id):
def get_lot_questions_response(self, lot_questions_response_id, with_evaluations=None):
return self._get(
f"/lot-questions-responses/{lot_questions_response_id}"
f"/lot-questions-responses/{lot_questions_response_id}",
params={
"with_evaluations": with_evaluations
}
)

def get_lot_questions_response_by_framework_lot_suppler(self, framework_slug, lot_slug, supplier_id):
Expand Down Expand Up @@ -1660,7 +1663,7 @@ def get_lot_questions_response_section_evaluation(

def create_lot_questions_response_section_evaluation(
self,
lot_question_response_id,
lot_questions_response_id,
section_slug,
lot_questions_response_section_evaluation,
page_questions,
Expand All @@ -1669,7 +1672,7 @@ def create_lot_questions_response_section_evaluation(
return self._post_with_updated_by(
'/lot-questions-response-section-evaluations',
data={
'lotQuestionsResponseId': lot_question_response_id,
'lotQuestionsResponseId': lot_questions_response_id,
'sectionSlug': section_slug,
'lotQuestionsResponseSectionEvaluations': lot_questions_response_section_evaluation,
'page_questions': page_questions
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 @@ -4192,6 +4192,17 @@ def test_get_lot_questions_response_should_return_404(self, data_client, rmock):
except HTTPError:
assert rmock.called

def test_get_lot_questions_response_with_evaluations(self, data_client, rmock):
rmock.get(
"http://baseurl/lot-questions-responses/1234?with_evaluations=True",
json={"lotQuestionsResponses": "result"},
status_code=200)

result = data_client.get_lot_questions_response(1234, with_evaluations=True)

assert result == {"lotQuestionsResponses": "result"}
assert rmock.called

def test_get_lot_questions_response_by_framework_lot_suppler(self, data_client, rmock):
rmock.get(
"http://baseurl/lot-questions-responses/frameworks/g-cloud-6/lots/g-things/suppliers/1234",
Expand Down

0 comments on commit 4f6cfc6

Please sign in to comment.