Skip to content

Commit 6c310b9

Browse files
committed
[feature/PI-606-changelog_add_an_mhs] e2e update
1 parent b0f6f06 commit 6c310b9

File tree

61 files changed

+4657
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4657
-358
lines changed

src/api/createDeviceMessageHandlingSystem/tests/test_index.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
QuestionnaireRepository,
2424
)
2525
from event.json import json_loads
26-
from sds.epr.constants import MHS_DEVICE_SUFFIX, EprNameTemplate
26+
from sds.epr.constants import EprNameTemplate
27+
from sds.epr.utils import is_mhs_device
2728

2829
from test_helpers.dynamodb import mock_table
2930
from test_helpers.uuid import consistent_uuid
@@ -210,7 +211,7 @@ def test_index() -> None:
210211
device = Device(**_device)
211212
assert device.product_team_id == product.product_team_id
212213
assert device.product_id == product.id
213-
assert device.name.endswith(MHS_DEVICE_SUFFIX)
214+
assert is_mhs_device(device)
214215
assert device.ods_code == ODS_CODE
215216
assert device.created_on.date() == datetime.today().date()
216217
assert device.updated_on.date() == datetime.today().date()

src/etl/sds/tests/changelog/changelog_components/add/message_handling_system.AnotherWithSameUniqueIdentifier.ldif

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ nhsMhsSvcIA: urn:nhs:names:services:ers:ABCDEFG
2121
nhsProductKey: 11929
2222
nhsProductVersion: Mar2023
2323
nhsRequestorURP: uniqueidentifier=555050304105,uniqueidentifier=555008548101,uid=555008545108,ou=people, o=nhs
24+
nhsMhsManufacturerOrg: LSP04
2425
uniqueIdentifier: 00000a84594b2ef34279

src/etl/sds/tests/changelog/changelog_components/add/message_handling_system.ldif

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ nhsMhsSvcIA: urn:nhs:names:services:ers:READ_PRACTITIONER_ROLE_R4_V001
2121
nhsProductKey: 11929
2222
nhsProductVersion: Mar2023
2323
nhsRequestorURP: uniqueidentifier=555050304105,uniqueidentifier=555008548101,uid=555008545108,ou=people, o=nhs
24+
nhsMhsManufacturerOrg: C3O9X
2425
uniqueIdentifier: 00000a84594b2ef34279

src/etl/sds/tests/changelog/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def extract_handler(scenario: Scenario, s3_client: S3Client):
8181
{"ETL_BUCKET": ETL_BUCKET, "AWS_DEFAULT_REGION": "us-east-1"},
8282
clear=True,
8383
):
84-
from etl.sds.worker.extract import extract
84+
from etl.sds.worker.update.extract_update import extract_update
8585

86-
extract.ENVIRONMENT = WorkerEnvironment.build()
87-
extract.S3_CLIENT = s3_client
88-
yield extract.handler
86+
extract_update.ENVIRONMENT = WorkerEnvironment.build()
87+
extract_update.S3_CLIENT = s3_client
88+
yield extract_update.handler
8989

9090

9191
@pytest.fixture
@@ -97,7 +97,7 @@ def transform_handler(scenario: Scenario):
9797
os.environ["ETL_BUCKET"] = etl_bucket
9898
os.environ["TABLE_NAME"] = read_terraform_output("dynamodb_table_name.value")
9999

100-
from etl.sds.worker.transform_update import transform_update
100+
from etl.sds.worker.update.transform_update import transform_update
101101

102102
transform_update.S3_CLIENT.put_object(
103103
Bucket=etl_bucket,
@@ -122,7 +122,7 @@ def load_handler(scenario: Scenario):
122122
os.environ["ETL_BUCKET"] = read_terraform_output("sds_etl.value.bucket")
123123
os.environ["TABLE_NAME"] = read_terraform_output("dynamodb_table_name.value")
124124

125-
from etl.sds.worker.load_update import load_update
125+
from etl.sds.worker.update.load_update import load_update
126126

127127
yield load_update.handler
128128
os.environ = original_environ
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from etl.sds.tests.changelog.utils import ADD_MESSAGE_HANDLING_SYSTEM, _Scenario
2+
3+
SCENARIO = _Scenario(
4+
file_path=__file__,
5+
extract_input=[
6+
ADD_MESSAGE_HANDLING_SYSTEM,
7+
],
8+
)

src/etl/sds/tests/changelog/scenarios/message_handling_system/can_add_optional_field/extract_output.json renamed to src/etl/sds/tests/changelog/scenarios/message_handling_system/can_add_mhs/extract_output.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"nhs_mhs_in": "READ_PRACTITIONER_ROLE_R4_V001",
1919
"nhs_mhs_ip_address": null,
2020
"nhs_mhs_is_authenticated": "none",
21-
"nhs_mhs_manufacturer_org": null,
21+
"nhs_mhs_manufacturer_org": "C3O9X",
2222
"nhs_mhs_party_key": "C3O9X-823610",
2323
"nhs_mhs_persist_duration": null,
2424
"nhs_mhs_retries": null,
@@ -33,11 +33,5 @@
3333
"nhs_requestor_urp": "uniqueidentifier=555050304105,uniqueidentifier=555008548101,uid=555008545108,ou=people, o=nhs",
3434
"object_class": "nhsMhs",
3535
"unique_identifier": "00000a84594b2ef34279"
36-
},
37-
{
38-
"change_type": "modify",
39-
"modifications": [["add", "nhsmhsackrequested", ["never"]]],
40-
"object_class": "modify",
41-
"unique_identifier": "00000a84594b2ef34279"
4236
}
4337
]
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
[
2+
{
3+
"id": "C3O9X.fe49c1d5-d9bc-4c2e-8e8d-54d8e2e88250",
4+
"name": "C3O9X (EPR)",
5+
"ods_code": "C3O9X",
6+
"status": "active",
7+
"created_on": "2024-12-11T11:18:53.365591+00:00",
8+
"updated_on": null,
9+
"deleted_on": null,
10+
"keys": [{ "key_type": "epr_id", "key_value": "EPR-C3O9X" }]
11+
},
12+
{
13+
"id": "P.9AN-PJG",
14+
"product_team_id": "C3O9X.fe49c1d5-d9bc-4c2e-8e8d-54d8e2e88250",
15+
"name": "00000a84594b2ef34279",
16+
"ods_code": "C3O9X",
17+
"status": "active",
18+
"created_on": "2024-12-11T11:18:53.407960+00:00",
19+
"updated_on": "2024-12-11T11:18:53.408432+00:00",
20+
"deleted_on": null,
21+
"keys": [{ "key_type": "party_key", "key_value": "C3O9X-823610" }]
22+
},
23+
{
24+
"id": "fe15bd58-6897-4566-9a87-aab781fd96b5",
25+
"name": "C3O9X-823610 - Message Handling System",
26+
"status": "active",
27+
"product_id": "P.9AN-PJG",
28+
"product_team_id": "C3O9X.fe49c1d5-d9bc-4c2e-8e8d-54d8e2e88250",
29+
"ods_code": "C3O9X",
30+
"created_on": "2024-12-11T11:18:53.532840+00:00",
31+
"updated_on": "2024-12-11T11:18:53.534066+00:00",
32+
"deleted_on": null,
33+
"keys": [{ "key_type": "cpa_id", "key_value": "00000a84594b2ef34279" }],
34+
"tags": [],
35+
"questionnaire_responses": {
36+
"spine_mhs/1": [
37+
{
38+
"id": "07dacf01-359a-4276-9dd2-e11ecb07076a",
39+
"questionnaire_name": "spine_mhs",
40+
"questionnaire_version": "1",
41+
"data": {
42+
"Managing Organization": "C3O9X",
43+
"Contract Property Template Key": "14",
44+
"Interaction Type": "fhir",
45+
"Address": "https://test.C3O9X.nhs.uk/",
46+
"DNS Approver": "uniqueidentifier=555050304105,uniqueidentifier=555008548101,uid=555008545108,ou=people, o=nhs",
47+
"MHS Party key": "C3O9X-823610",
48+
"Product Key": "11929",
49+
"Date Approved": "20231030092939",
50+
"Product Version": "Mar2023",
51+
"Approver URP": "uniqueidentifier=555050304105,uniqueidentifier=555008548101,uid=555008545108,ou=people, o=nhs",
52+
"Date DNS Approved": "20231030092939",
53+
"Requestor URP": "uniqueidentifier=555050304105,uniqueidentifier=555008548101,uid=555008545108,ou=people, o=nhs",
54+
"MHS Is Authenticated": "none",
55+
"MHS CPA ID": "00000a84594b2ef34279",
56+
"Date Requested": "20231030092906",
57+
"Unique Identifier": "00000a84594b2ef34279",
58+
"MHS FQDN": "test.C3O9X.nhs.uk",
59+
"MHS Manufacturer Organisation": "C3O9X"
60+
},
61+
"created_on": "2024-12-11T11:18:53.456536+00:00"
62+
}
63+
]
64+
},
65+
"device_reference_data": { "68cd98db-5d8d-45dc-ba9a-09e892535d83": ["*"] }
66+
},
67+
{
68+
"id": "68cd98db-5d8d-45dc-ba9a-09e892535d83",
69+
"name": "C3O9X-823610 - MHS Message Sets",
70+
"status": "active",
71+
"product_id": "P.9AN-PJG",
72+
"product_team_id": "C3O9X.fe49c1d5-d9bc-4c2e-8e8d-54d8e2e88250",
73+
"ods_code": "C3O9X",
74+
"questionnaire_responses": {
75+
"spine_mhs_message_sets/1": [
76+
{
77+
"id": "2071f8ac-a020-4bf3-b413-c205004bfb08",
78+
"questionnaire_name": "spine_mhs_message_sets",
79+
"questionnaire_version": "1",
80+
"data": {
81+
"Interaction ID": "urn:nhs:names:services:ers:READ_PRACTITIONER_ROLE_R4_V001",
82+
"MHS SN": "urn:nhs:names:services:ers",
83+
"MHS IN": "READ_PRACTITIONER_ROLE_R4_V001"
84+
},
85+
"created_on": "2024-12-11T11:18:53.409854+00:00"
86+
}
87+
]
88+
},
89+
"created_on": "2024-12-11T11:18:53.452472+00:00",
90+
"updated_on": "2024-12-11T11:18:53.452853+00:00",
91+
"deleted_on": null
92+
}
93+
]

src/etl/sds/tests/changelog/scenarios/message_handling_system/can_add_optional_field/__init__.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/etl/sds/tests/changelog/scenarios/message_handling_system/can_add_optional_field/load_output.json

Lines changed: 0 additions & 153 deletions
This file was deleted.

0 commit comments

Comments
 (0)