Skip to content

Commit

Permalink
Merge pull request #107 from Crown-Commercial-Service/add-page-questi…
Browse files Browse the repository at this point in the history
…on-supplier-evaluation-update

Add page questions to update for supplier evaluation
  • Loading branch information
tim-s-ccs authored Jul 23, 2024
2 parents 6e5532b + 2122c6d commit f801e24
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 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__ = '25.14.0'
__version__ = '25.14.1'

from .errors import APIError, HTTPError, InvalidResponse # noqa
from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa
Expand Down
14 changes: 10 additions & 4 deletions dmapiclient/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,13 +1494,19 @@ def update_supplier_evaluation(
framework_slug,
lot_slug,
evaluation,
user=None
user=None,
page_questions=None
):
data = {
"evaluation": evaluation,
}

if page_questions is not None:
data['page_questions'] = page_questions

return self._patch_with_updated_by(
f"/suppliers/{supplier_id}/frameworks/{framework_slug}/evaluations/{lot_slug}",
data={
"evaluation": evaluation,
},
data=data,
user=user,
)

Expand Down
27 changes: 26 additions & 1 deletion tests/test_data_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3834,7 +3834,8 @@ def test_update_supplier_evaluation(self, data_client, rmock):
rmock.patch(
"http://baseurl/suppliers/1234/frameworks/g-cloud-6/evaluations/g-lot",
json={"evaluation": {"question": "answer"}},
status_code=200)
status_code=200
)

result = data_client.update_supplier_evaluation(1234, 'g-cloud-6', 'g-lot', {"question": "answer"}, "user")

Expand All @@ -3845,6 +3846,30 @@ def test_update_supplier_evaluation(self, data_client, rmock):
'evaluation': {'question': 'answer'}
}

def test_update_supplier_evaluation_with_page_questions(self, data_client, rmock):
rmock.patch(
"http://baseurl/suppliers/1234/frameworks/g-cloud-6/evaluations/g-lot",
json={"evaluation": {"question": "answer"}},
status_code=200
)

result = data_client.update_supplier_evaluation(
1234,
'g-cloud-6',
'g-lot',
{"question": "answer"},
"user",
["question"]
)

assert result == {'evaluation': {'question': 'answer'}}
assert rmock.called
assert rmock.request_history[0].json() == {
'updated_by': 'user',
'evaluation': {'question': 'answer'},
'page_questions': ['question']
}

def test_complete_supplier_evaluation(self, data_client, rmock):
rmock.post(
"http://baseurl/suppliers/1234/frameworks/g-cloud-6/evaluations/g-lot/complete",
Expand Down

0 comments on commit f801e24

Please sign in to comment.