Skip to content

Commit

Permalink
Merge pull request #195 from Crown-Commercial-Service/feature/NDMP-58…
Browse files Browse the repository at this point in the history
…7-revoke-cdp-connection

NDMP-587 - Add method for revoking connection to the CDP
  • Loading branch information
tim-s-ccs authored Jan 24, 2025
2 parents 9802c2f + 1a68431 commit bfdedbe
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dmapiclient/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '30.2.0'
__version__ = '30.3.0'

from .errors import APIError, HTTPError, InvalidResponse, InvalidResponseType # 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"
supplier_central_digital_platform_connection_created = "supplier_central_digital_platform_connection_created"
contact_update_from_central_digital_platform = "contact_update_from_central_digital_platform"
supplier_central_digital_platform_connection_revoked = "supplier_central_digital_platform_connection_revoked"

# 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 @@ -183,6 +183,13 @@ def create_central_digital_platform_connection(self, supplier_id, central_digita
user=user,
)

def revoke_central_digital_platform_connection(self, supplier_id, user=None):
return self._post_with_updated_by(
f"/suppliers/{supplier_id}/central-digital-platform/revoke",
data={},
user=user,
)

def get_framework_interest(self, supplier_id):
return self._get(
"/suppliers/{}/frameworks/interest".format(supplier_id)
Expand Down
18 changes: 18 additions & 0 deletions tests/test_data_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,24 @@ def test_create_central_digital_platform_connection(self, data_client, rmock):
'updated_by': 'user',
}

def test_revoke_central_digital_platform_connection(self, data_client, rmock):
rmock.post(
"http://baseurl/suppliers/1234/central-digital-platform/revoke",
json={"message": "done"},
status_code=200
)

result = data_client.revoke_central_digital_platform_connection(
1234,
'user'
)

assert result == {'message': 'done'}
assert rmock.called
assert rmock.request_history[0].json() == {
'updated_by': 'user',
}

def test_get_framework_interest(self, data_client, rmock):
rmock.get(
"http://baseurl/suppliers/123/frameworks/interest",
Expand Down

0 comments on commit bfdedbe

Please sign in to comment.