Skip to content

Commit 6ae0797

Browse files
committed
NRL-1472 include new format and content type in parameterised tests
1 parent 9703cdb commit 6ae0797

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

layer/nrlf/core/tests/test_validators.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,7 +1385,7 @@ def test_validate_content_invalid_content_type():
13851385
}
13861386
]
13871387
},
1388-
"diagnostics": "Invalid contentType: invalid/type. Must be 'application/pdf' or 'text/html'",
1388+
"diagnostics": "Invalid contentType: invalid/type. Must be 'application/pdf', 'text/html' or 'application/fhir+json'",
13891389
"expression": ["content[0].attachment.contentType"],
13901390
}
13911391

@@ -1415,27 +1415,34 @@ def test_validate_nrl_format_code_valid_match(format_code, format_display):
14151415

14161416

14171417
@pytest.mark.parametrize(
1418-
"format_code, format_display, expected_display",
1418+
"content_type, format_code, format_display, expected_display",
14191419
[
14201420
(
1421+
"application/pdf",
14211422
"urn:nhs-ic:unstructured",
14221423
"Contact details (HTTP Unsecured)",
14231424
"Unstructured Document",
14241425
),
14251426
(
1427+
"text/html",
14261428
"urn:nhs-ic:record-contact",
14271429
"Unstructured Document",
14281430
"Contact details (HTTP Unsecured)",
14291431
),
1432+
(
1433+
"application/fhir+json",
1434+
"urn:nhs-ic:structured",
1435+
"Unstructured Document",
1436+
"Structured Document",
1437+
),
14301438
],
14311439
)
14321440
def test_validate_nrl_format_code_display_mismatch(
1433-
format_code, format_display, expected_display
1441+
content_type, format_code, format_display, expected_display
14341442
):
14351443
validator = DocumentReferenceValidator()
14361444
document_ref_data = load_document_reference_json("Y05868-736253002-Valid")
1437-
if format_code == "urn:nhs-ic:record-contact":
1438-
document_ref_data["content"][0]["attachment"]["contentType"] = "text/html"
1445+
document_ref_data["content"][0]["attachment"]["contentType"] = content_type
14391446

14401447
document_ref_data["content"][0]["format"] = {
14411448
"system": "https://fhir.nhs.uk/England/CodeSystem/England-NRLFormatCode",

0 commit comments

Comments
 (0)