55from __future__ import annotations
66
77import pytest
8+ from fhir .constants import FHIRSystem
89from stubs .sds .stub import SdsFhirApiStub
910
1011from gateway_api .get_structured_record import ACCESS_RECORD_STRUCTURED_INTERACTION_ID
@@ -70,17 +71,17 @@ def test_sds_client_get_org_details_with_endpoint(
7071 "id" : "test-device-id" ,
7172 "identifier" : [
7273 {
73- "system" : "https://fhir.nhs.uk/Id/nhsSpineASID" ,
74+ "system" : FHIRSystem . NHS_SPINE_ASID ,
7475 "value" : "999999999999" ,
7576 },
7677 {
77- "system" : "https://fhir.nhs.uk/Id/nhsMhsPartyKey" ,
78+ "system" : FHIRSystem . NHS_MHS_PARTY_KEY ,
7879 "value" : "TESTORG-123456" ,
7980 },
8081 ],
8182 "owner" : {
8283 "identifier" : {
83- "system" : "https://fhir.nhs.uk/Id/ods-organization-code" ,
84+ "system" : FHIRSystem . ODS_CODE ,
8485 "value" : "TESTORG" ,
8586 }
8687 },
@@ -98,13 +99,13 @@ def test_sds_client_get_org_details_with_endpoint(
9899 "address" : "https://testorg.example.com/fhir" ,
99100 "managingOrganization" : {
100101 "identifier" : {
101- "system" : "https://fhir.nhs.uk/Id/ods-organization-code" ,
102+ "system" : FHIRSystem . ODS_CODE ,
102103 "value" : "TESTORG" ,
103104 }
104105 },
105106 "identifier" : [
106107 {
107- "system" : "https://fhir.nhs.uk/Id/nhsMhsPartyKey" ,
108+ "system" : FHIRSystem . NHS_MHS_PARTY_KEY ,
108109 "value" : "TESTORG-123456" ,
109110 }
110111 ],
@@ -179,13 +180,13 @@ def test_sds_client_custom_service_interaction_id(
179180 "id" : "custom-device" ,
180181 "identifier" : [
181182 {
182- "system" : "https://fhir.nhs.uk/Id/nhsSpineASID" ,
183+ "system" : FHIRSystem . NHS_SPINE_ASID ,
183184 "value" : "777777777777" ,
184185 }
185186 ],
186187 "owner" : {
187188 "identifier" : {
188- "system" : "https://fhir.nhs.uk/Id/ods-organization-code" ,
189+ "system" : FHIRSystem . ODS_CODE ,
189190 "value" : "CUSTOMINT" ,
190191 }
191192 },
@@ -226,16 +227,13 @@ def test_sds_client_builds_correct_device_query_params(
226227 params = stub .get_params
227228
228229 # Check organization parameter
229- assert (
230- params ["organization" ]
231- == "https://fhir.nhs.uk/Id/ods-organization-code|PROVIDER"
232- )
230+ assert params ["organization" ] == f"{ FHIRSystem .ODS_CODE } |PROVIDER"
233231
234232 # Check identifier list contains interaction ID
235233 identifiers = params ["identifier" ]
236234 assert isinstance (identifiers , list )
237235 assert any (
238- "https://fhir.nhs.uk/Id/nhsServiceInteractionId |" in str (ident )
236+ f" { FHIRSystem . NHS_SERVICE_INTERACTION_ID } |" in str (ident )
239237 for ident in identifiers
240238 )
241239
@@ -261,11 +259,11 @@ def test_sds_client_extract_party_key_from_device(
261259 "id" : "device-with-party-key" ,
262260 "identifier" : [
263261 {
264- "system" : "https://fhir.nhs.uk/Id/nhsSpineASID" ,
262+ "system" : FHIRSystem . NHS_SPINE_ASID ,
265263 "value" : "888888888888" ,
266264 },
267265 {
268- "system" : "https://fhir.nhs.uk/Id/nhsMhsPartyKey" ,
266+ "system" : FHIRSystem . NHS_MHS_PARTY_KEY ,
269267 "value" : "WITHPARTYKEY-654321" ,
270268 },
271269 ],
@@ -283,7 +281,7 @@ def test_sds_client_extract_party_key_from_device(
283281 "address" : "https://withpartykey.example.com/fhir" ,
284282 "identifier" : [
285283 {
286- "system" : "https://fhir.nhs.uk/Id/nhsMhsPartyKey" ,
284+ "system" : FHIRSystem . NHS_MHS_PARTY_KEY ,
287285 "value" : "WITHPARTYKEY-654321" ,
288286 }
289287 ],
0 commit comments