Skip to content

Commit e54fabe

Browse files
NPA-5088: Made use of ConsentID parameter component in patch endpoint and updated sandbox
1 parent 58e7c82 commit e54fabe

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

sandbox/api/patch_consent.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
logger = getLogger(__name__)
1818

1919

20-
def patch_consent_response(identifier: str) -> Union[dict, tuple]:
20+
def patch_consent_response(id: str) -> Union[dict, tuple]:
2121
"""Sandbox API for PATCH /Consent
2222
2323
Args:
24-
identifier (str): Consent identifier to be patched
24+
id (str): Consent id to be patched
2525
2626
Returns:
2727
Union[dict, tuple]: Response for PATCH /Consent
@@ -31,35 +31,35 @@ def patch_consent_response(identifier: str) -> Union[dict, tuple]:
3131
# Validate body - validation is beyond the scope of the sandbox.
3232
# Assume all requests are valid
3333

34-
if identifier == "c512b0db-6702-43ee-8c21-bbded2552da9":
34+
if id == "c512b0db-6702-43ee-8c21-bbded2552da9":
3535
# Successful status update
3636
return generate_response_from_example(PATCH_CONSENT__SUCCESS, 200)
3737

38-
elif identifier == "6b71ac92-baa3-4b76-b0f5-a601257e2722":
38+
elif id == "6b71ac92-baa3-4b76-b0f5-a601257e2722":
3939
# Successful end date for a role
4040
return generate_response_from_example(PATCH_CONSENT__SUCCESS, 200)
4141

42-
elif identifier == "43003db8-ffcd-4bd6-ab2f-b49b9656f9e5":
42+
elif id == "43003db8-ffcd-4bd6-ab2f-b49b9656f9e5":
4343
# Multiple valid changes
4444
return generate_response_from_example(PATCH_CONSENT__SUCCESS, 200)
4545

46-
elif identifier == "849ea584-2318-471b-a24c-cee1b5ad0137":
46+
elif id == "849ea584-2318-471b-a24c-cee1b5ad0137":
4747
# Invalid patch format
4848
return generate_response_from_example(PATCH_CONSENT__INVALID_PATCH_FORMAT, 400)
4949

50-
elif identifier == "01abb0c5-b1ac-499d-9655-9cd0b8d3588f":
50+
elif id == "01abb0c5-b1ac-499d-9655-9cd0b8d3588f":
5151
# Invalid path
5252
return generate_response_from_example(PATCH_CONSENT__INVALID_PATH, 400)
5353

54-
elif identifier == "78c35330-fa2f-4934-a5dd-fff847f38de5":
54+
elif id == "78c35330-fa2f-4934-a5dd-fff847f38de5":
5555
# Invalid status code
5656
return generate_response_from_example(PATCH_CONSENT__INVALID_STATUS_CODE, 422)
5757

58-
elif identifier == "51fb4df5-815a-45cd-8427-04d6558336b7":
58+
elif id == "51fb4df5-815a-45cd-8427-04d6558336b7":
5959
# Invalid status reason
6060
return generate_response_from_example(PATCH_CONSENT__INVALID_STATUS_REASON, 422)
6161

62-
elif identifier == "7b7f47b8-96e5-43eb-b733-283bf1449f2c":
62+
elif id == "7b7f47b8-96e5-43eb-b733-283bf1449f2c":
6363
# Invalid state transition
6464
return generate_response_from_example(PATCH_CONSENT__INVALID_STATE_TRANSITION, 422)
6565

specification/validated-relationships-service-api.yaml

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -853,24 +853,7 @@ paths:
853853
| Resource not found | Patch for non-existent Consent, request with an id not listed here | HTTP Status 404 and RESOURCE_NOT_FOUND error response |
854854
| Invalid state transition | Patch attempting invalid status change, request with id '7b7f47b8-96e5-43eb-b733-283bf1449f2c' | HTTP Status 422 and INVALID_STATE_TRANSITION error response |
855855
parameters:
856-
# Change id parameter to Component ConsentID when NPA-5088 is complete
857-
- name: id
858-
in: path
859-
required: true
860-
description: The UUID of the Consent resource to update
861-
schema:
862-
type: string
863-
format: uuid
864-
examples:
865-
statusUpdate:
866-
value: c512b0db-6702-43ee-8c21-bbded2552da9
867-
summary: Update consent status
868-
updateProvision:
869-
value: 6b71ac92-baa3-4b76-b0f5-a601257e2722
870-
summary: Set an end date for a role
871-
multipleUpdates:
872-
value: 43003db8-ffcd-4bd6-ab2f-b49b9656f9e5
873-
summary: Set status to active with an end date
856+
- $ref: "#/components/parameters/ConsentID"
874857
requestBody:
875858
required: true
876859
content:

0 commit comments

Comments
 (0)