Skip to content

Commit

Permalink
feature/PI-581-create_mhs_device_with_drd Update interaction_id Key r…
Browse files Browse the repository at this point in the history
…egex to allow interaction id format
  • Loading branch information
megan-bower4 committed Nov 13, 2024
1 parent 95ab1a5 commit 77bf90f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ Feature: Create MHS Device - success scenarios
And I note the response field "$.id" as "product_id"
And I note the response field "$.keys.0.key_type" as "party_key_tag"
And I note the response field "$.keys.0.key_value" as "party_key_value"
And I have already made a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id) }/DeviceReferenceData/MhsMessageSet"
And I have already made a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id) }/DeviceReferenceData/MhsMessageSet" with body:
| path | value |
| questionnaire_responses.spine_mhs_message_sets.0.Interaction ID | urn:nhs:names:services:ers:READ_PRACTITIONER_ROLE_R4_V001 |
| questionnaire_responses.spine_mhs_message_sets.0.MHS SN | urn:nhs:names:services:ers |
| questionnaire_responses.spine_mhs_message_sets.0.MHS IN | READ_PRACTITIONER_ROLE_R4_V001 |
And I note the response field "$.id" as "message_set_drd_id"
When I make a "POST" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id) }/Device/MessageHandlingSystem" with body:
| path | value |
Expand All @@ -40,41 +44,43 @@ Feature: Create MHS Device - success scenarios
| questionnaire_responses.spine_mhs.0.Product Key | product-key-001 |
| questionnaire_responses.spine_mhs.0.Requestor URP | requestor-789 |
Then I receive a status code "201" with body
| path | value |
| id | << ignore >> |
| name | Product-MHS |
| status | active |
| product_id | ${ note(product_id) } |
| product_team_id | ${ note(product_team_id) } |
| ods_code | F5H1R |
| created_on | << ignore >> |
| updated_on | << ignore >> |
| deleted_on | << ignore >> |
| keys | [] |
| questionnaire_responses | << ignore >> |
| device_reference_data | << ignore >> |
| path | value |
| id | << ignore >> |
| name | Product-MHS |
| status | active |
| product_id | ${ note(product_id) } |
| product_team_id | ${ note(product_team_id) } |
| ods_code | F5H1R |
| created_on | << ignore >> |
| updated_on | << ignore >> |
| deleted_on | << ignore >> |
| keys.0.key_type | interaction_id |
| keys.0.key_value | F5H1R-850000:urn:nhs:names:services:ers:READ_PRACTITIONER_ROLE_R4_V001 |
| questionnaire_responses | << ignore >> |
| device_reference_data | << ignore >> |
And the response headers contain:
| name | value |
| Content-Type | application/json |
| Content-Length | 1178 |
| Content-Length | 1295 |
And I note the response field "$.id" as "device_id"
When I make a "GET" request with "default" headers to "ProductTeam/${ note(product_team_id) }/Product/${ note(product_id) }/Device/${ note(device_id) }"
Then I receive a status code "200" with body
| path | value |
| id | ${ note(device_id) } |
| name | Product-MHS |
| status | active |
| product_id | ${ note(product_id) } |
| product_team_id | ${ note(product_team_id) } |
| ods_code | F5H1R |
| created_on | << ignore >> |
| updated_on | << ignore >> |
| deleted_on | << ignore >> |
| keys | [] |
| tags.0.0.0 | ${ note(party_key_tag) } |
| tags.0.0.1 | ${ note(party_key_value) } |
| questionnaire_responses | << ignore >> |
| device_reference_data | << ignore >> |
| path | value |
| id | ${ note(device_id) } |
| name | Product-MHS |
| status | active |
| product_id | ${ note(product_id) } |
| product_team_id | ${ note(product_team_id) } |
| ods_code | F5H1R |
| created_on | << ignore >> |
| updated_on | << ignore >> |
| deleted_on | << ignore >> |
| keys.0.key_type | interaction_id |
| keys.0.key_value | F5H1R-850000:urn:nhs:names:services:ers:READ_PRACTITIONER_ROLE_R4_V001 |
| tags.0.0.0 | ${ note(party_key_tag) } |
| tags.0.0.1 | ${ note(party_key_value) } |
| questionnaire_responses | << ignore >> |
| device_reference_data | << ignore >> |
And the response headers contain:
| name | value |
| Content-Type | application/json |
Expand Down
2 changes: 1 addition & 1 deletion src/layers/domain/core/device_key/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def pattern(self) -> re.Pattern:
case DeviceKeyType.MESSAGE_HANDLING_SYSTEM_ID:
return SdsId.MessageHandlingSystem.ID_PATTERN
case DeviceKeyType.INTERACTION_ID:
return re.compile(rf"{SdsId.PartyKey.PARTY_KEY_REGEX[:-1]}:[\w-]+$")
return re.compile(rf"{SdsId.PartyKey.PARTY_KEY_REGEX[:-1]}:urn:[\w:]+$")
case _:
raise NotImplementedError(f"No ID validation configured for '{self}'")

Expand Down

0 comments on commit 77bf90f

Please sign in to comment.