Skip to content

Commit

Permalink
Merge pull request #103 from Crown-Commercial-Service/feature/DMP-663…
Browse files Browse the repository at this point in the history
…-add-complete-evaluation-route

DMP-663 - Add the complete_supplier_evaluation method
  • Loading branch information
tim-s-ccs authored Jul 19, 2024
2 parents 8096911 + 5445476 commit 2574320
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 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.13.0'
__version__ = '25.14.0'

from .errors import APIError, HTTPError, InvalidResponse # noqa
from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa
Expand Down
1 change: 1 addition & 0 deletions dmapiclient/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions dmapiclient/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
16 changes: 15 additions & 1 deletion tests/test_data_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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',
}

0 comments on commit 2574320

Please sign in to comment.