Skip to content

Commit

Permalink
Merge pull request #158 from Crown-Commercial-Service/add-route-for-v…
Browse files Browse the repository at this point in the history
…erifying-the-application

Add the route for verifying the application
  • Loading branch information
tim-s-ccs authored Nov 26, 2024
2 parents 2a06e97 + 80f3405 commit 6f1470c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 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.8.0'
__version__ = '29.9.0'

from .errors import APIError, HTTPError, InvalidResponse # noqa
from .errors import REQUEST_ERROR_STATUS_CODE, REQUEST_ERROR_MESSAGE # noqa
Expand Down
11 changes: 10 additions & 1 deletion dmapiclient/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,9 @@ def find_supplier_framework_applications_by_lot(
page=None
):
return self._get(
f"/frameworks/{framework_slug}/suppliers/applications/{lot_slug}",
f"/frameworks/{framework_slug}/suppliers/applications",
params={
'lot': lot_slug,
'evaluation_status': evaluation_status,
'section_slug': section_slug,
'evaluator_framework_lot_id': evaluator_framework_lot_id,
Expand All @@ -427,6 +428,14 @@ def find_supplier_framework_applications_by_lot(
)
find_supplier_framework_applications_by_lot_iter.__name__ = str("find_supplier_framework_applications_by_lot_iter")

def verify_supplier_framework_application(self, framework_slug, supplier_id, lot_slug=None):
return self._get(
f"/frameworks/{framework_slug}/suppliers/{supplier_id}/applications/verify",
params={
'lot': lot_slug
}
)

def export_suppliers(self, framework_slug):
return self._get(
"/suppliers/export/{}".format(framework_slug)
Expand Down
32 changes: 27 additions & 5 deletions tests/test_data_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ def test_find_framework_suppliers_no_lot_responses(self, data_client, rmock):

def test_find_supplier_framework_applications_by_lot(self, data_client, rmock):
rmock.get(
'http://baseurl/frameworks/g-cloud-7/suppliers/applications/cloud-sourcing',
'http://baseurl/frameworks/g-cloud-7/suppliers/applications?lot=cloud-sourcing',
json={'supplierFrameworks': [{"supplierId": 1}, {"supplierId": 2}]},
status_code=200)

Expand All @@ -1291,8 +1291,8 @@ def test_find_supplier_framework_applications_by_lot(self, data_client, rmock):

def test_find_supplier_framework_applications_by_lot_with_attributes(self, data_client, rmock):
rmock.get(
'http://baseurl/frameworks/g-cloud-7/suppliers/applications/cloud-sourcing'
'?evaluation_status=not-evaluated&section_slug=slug-name&evaluator_framework_lot_id=1234',
'http://baseurl/frameworks/g-cloud-7/suppliers/applications?lot=cloud-sourcing'
'&evaluation_status=not-evaluated&section_slug=slug-name&evaluator_framework_lot_id=1234',
json={'supplierFrameworks': [{"supplierId": 1}, {"supplierId": 2}]},
status_code=200)

Expand All @@ -1307,6 +1307,28 @@ def test_find_supplier_framework_applications_by_lot_with_attributes(self, data_
assert result == {'supplierFrameworks': [{"supplierId": 1}, {"supplierId": 2}]}
assert rmock.called

def test_verify_supplier_framework_application(self, data_client, rmock):
rmock.get(
"http://baseurl/frameworks/g-things-88/suppliers/1234/applications/verify",
json={"applicationStatus": "result"},
status_code=200)

result = data_client.verify_supplier_framework_application('g-things-88', 1234)

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

def test_verify_supplier_framework_application_with_lot(self, data_client, rmock):
rmock.get(
"http://baseurl/frameworks/g-things-88/suppliers/1234/applications/verify?lot=g-thing",
json={"applicationStatus": "result"},
status_code=200)

result = data_client.verify_supplier_framework_application('g-things-88', 1234, 'g-thing')

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

def test_can_export_suppliers(self, data_client, rmock):
rmock.get(
"http://baseurl/suppliers/export/g-cloud-9",
Expand Down Expand Up @@ -3210,10 +3232,10 @@ def test_find_supplier_framework_applications_by_lot_iter(self, data_client, rmo
data_client, rmock,
method_name='find_supplier_framework_applications_by_lot_iter',
model_name='supplierFrameworks',
url_path='frameworks/g-cloud-6/suppliers/applications/g-things',
url_path='frameworks/g-cloud-6/suppliers/applications?lot=g-things',
iter_kwargs={
'framework_slug': 'g-cloud-6',
'lot_slug': 'g-things'
'lot_slug': 'g-things',
}
)

Expand Down

0 comments on commit 6f1470c

Please sign in to comment.