Skip to content

Commit 64ae355

Browse files
committed
[NRL-1165] Fix failing integ test. Fix sonarcloud warnings
1 parent 4cc04fb commit 64ae355

File tree

2 files changed

+25
-44
lines changed

2 files changed

+25
-44
lines changed

layer/nrlf/core/tests/test_pydantic_errors.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22

3+
from nrlf.core.constants import SNOMED_SYSTEM_URL
34
from nrlf.core.errors import ParseError
45
from nrlf.core.validators import DocumentReferenceValidator
56
from nrlf.tests.data import load_document_reference_json
@@ -310,17 +311,17 @@ def test_validate_multiple_codings():
310311
document_ref_data["category"][0] = {
311312
"coding": [
312313
{
313-
"system": "http://snomed.info/sct",
314+
"system": SNOMED_SYSTEM_URL,
314315
"code": "734163000",
315316
"display": "Care plan",
316317
},
317318
{
318-
"system": "http://snomed.info/sct",
319+
"system": SNOMED_SYSTEM_URL,
319320
"code": "734163000",
320321
"display": "Care plan",
321322
},
322323
{
323-
"system": "http://snomed.info/sct",
324+
"system": SNOMED_SYSTEM_URL,
324325
"code": "734163000",
325326
"display": "Care plan",
326327
},
@@ -384,7 +385,7 @@ def test_validate_empty_strings():
384385
document_ref_data["category"][0] = {
385386
"coding": [
386387
{
387-
"system": "http://snomed.info/sct",
388+
"system": SNOMED_SYSTEM_URL,
388389
"code": "734163000",
389390
"display": "",
390391
}
@@ -420,7 +421,7 @@ def test_validate_whitespace_strings():
420421
document_ref_data["category"][0] = {
421422
"coding": [
422423
{
423-
"system": "http://snomed.info/sct",
424+
"system": SNOMED_SYSTEM_URL,
424425
"code": "734163000",
425426
"display": " ",
426427
}
@@ -534,7 +535,7 @@ def test_validate_missing_code_from_coding_where_mandatory():
534535
document_ref_data["context"]["practiceSetting"] = {
535536
"coding": [
536537
{
537-
"system": "http://snomed.info/sct",
538+
"system": SNOMED_SYSTEM_URL,
538539
"display": "Valid display string",
539540
}
540541
]
@@ -569,7 +570,7 @@ def test_validate_missing_display_from_coding_where_mandatory():
569570
document_ref_data["context"]["practiceSetting"] = {
570571
"coding": [
571572
{
572-
"system": "http://snomed.info/sct",
573+
"system": SNOMED_SYSTEM_URL,
573574
"code": "788002001",
574575
}
575576
]

tests/features/producer/createDocumentReference-failure.feature

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -913,47 +913,27 @@ Feature: Producer - createDocumentReference - Failure Scenarios
913913
When producer 'TSTCUS' requests creation of a DocumentReference with default test values except 'context' is:
914914
"""
915915
"context": {
916-
"practiceSetting": {
917-
"coding": [
918-
{
919-
"system": "http://snomed.info/sct",
920-
"code": "788002001",
921-
"display": ""
922-
}
923-
]
924-
},
925-
"facilityType": {
926-
"coding": [
927-
{
928-
"system": " system",
929-
"code": "1234"
930-
}
931-
]
932-
}
933-
}
934-
"""
935-
Then the response status code is 400
936-
And the response is an OperationOutcome with 1 issue
937-
And the OperationOutcome contains the issue:
938-
"""
939-
{
940-
"severity": "error",
941-
"code": "invalid",
942-
"details": {
943-
"coding": [
916+
"practiceSetting": {
917+
"coding": [
944918
{
945-
"system": "https://fhir.nhs.uk/ValueSet/Spine-ErrorOrWarningCode-1",
946-
"code": "MESSAGE_NOT_WELL_FORMED",
947-
"display": "Message not well formed"
919+
"system": "http://snomed.info/sct",
920+
"code": "788002001",
921+
"display": ""
948922
}
949-
]
923+
]
950924
},
951-
"diagnostics": "Request body could not be parsed (context.facilityType.coding[0].system: String should match pattern '[^\\s]+(\\s[^\\s]+)*')",
952-
"expression": [
953-
"context.facilityType.coding[0].system"
954-
]
925+
"facilityType": {
926+
"coding": [
927+
{
928+
"system": " system",
929+
"code": "1234"
930+
}
931+
]
932+
}
955933
}
956934
"""
935+
Then the response status code is 400
936+
And the response is an OperationOutcome with 1 issue
957937
And the OperationOutcome contains the issue:
958938
"""
959939
{
@@ -968,7 +948,7 @@ Feature: Producer - createDocumentReference - Failure Scenarios
968948
}
969949
]
970950
},
971-
"diagnostics": "Request body could not be parsed (context.practiceSetting.coding[0].display: String should match pattern '[^\\s]+(\\s[^\\s]+)*')",
951+
"diagnostics": "Request body could not be parsed (context.practiceSetting.coding[0].display: String should match pattern '[\\S]+[ \\r\\n\\t\\S]*')",
972952
"expression": [
973953
"context.practiceSetting.coding[0].display"
974954
]

0 commit comments

Comments
 (0)