From 54454763c8c083cd6d7b0b0b4ce254297d182adc Mon Sep 17 00:00:00 2001 From: tim-s-ccs Date: Fri, 19 Jul 2024 11:39:19 +0100 Subject: [PATCH] Add the complete_supplier_evaluation method --- dmapiclient/__init__.py | 2 +- dmapiclient/audit.py | 1 + dmapiclient/data.py | 7 +++++++ tests/test_data_api_client.py | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/dmapiclient/__init__.py b/dmapiclient/__init__.py index 64e5849..b6c1579 100644 --- a/dmapiclient/__init__.py +++ b/dmapiclient/__init__.py @@ -1,4 +1,4 @@ -__version__ = '25.13.0' +__version__ = '25.14.0' from .errors import APIError, HTTPError, InvalidResponse # noqa from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa diff --git a/dmapiclient/audit.py b/dmapiclient/audit.py index 4d9eb3f..9003caa 100644 --- a/dmapiclient/audit.py +++ b/dmapiclient/audit.py @@ -50,6 +50,7 @@ class AuditTypes(Enum): update_supplier_framework = "update_supplier_framework" create_supplier_evaluation = "create_supplier_evaluation" update_supplier_evaluation_answers = "update_supplier_evaluation_answers" + complete_supplier_evaluation = "complete_supplier_evaluation" # Framework agreements create_agreement = "create_agreement" diff --git a/dmapiclient/data.py b/dmapiclient/data.py index 006b8c8..dc9c108 100644 --- a/dmapiclient/data.py +++ b/dmapiclient/data.py @@ -1503,3 +1503,10 @@ def update_supplier_evaluation( }, user=user, ) + + def complete_supplier_evaluation(self, supplier_id, framework_slug, lot_slug, user=None): + return self._post_with_updated_by( + f"/suppliers/{supplier_id}/frameworks/{framework_slug}/evaluations/{lot_slug}/complete", + data={}, + user=user, + ) diff --git a/tests/test_data_api_client.py b/tests/test_data_api_client.py index bbc880d..46414d2 100644 --- a/tests/test_data_api_client.py +++ b/tests/test_data_api_client.py @@ -3820,7 +3820,7 @@ def test_create_supplier_evaluation(self, data_client, rmock): rmock.post( "http://baseurl/suppliers/1234/frameworks/g-cloud-6/evaluations/g-lot", json={"evaluation": {"question": "answer"}}, - status_code=200) + status_code=201) result = data_client.create_supplier_evaluation(1234, 'g-cloud-6', 'g-lot', "user") @@ -3844,3 +3844,17 @@ def test_update_supplier_evaluation(self, data_client, rmock): 'updated_by': 'user', 'evaluation': {'question': 'answer'} } + + def test_complete_supplier_evaluation(self, data_client, rmock): + rmock.post( + "http://baseurl/suppliers/1234/frameworks/g-cloud-6/evaluations/g-lot/complete", + json={"message": "done"}, + status_code=200) + + result = data_client.complete_supplier_evaluation(1234, 'g-cloud-6', 'g-lot', "user") + + assert result == {'message': 'done'} + assert rmock.called + assert rmock.request_history[0].json() == { + 'updated_by': 'user', + }