From 5a5f926bedad389c91ccd821c3201fb58eb1daee Mon Sep 17 00:00:00 2001 From: SeanSteberis <103416906+seansteberisal@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:12:42 +0100 Subject: [PATCH 1/2] merged ELID 406 tests into story_tests Updated Error Scenario tests for ELID-404 --- .../AUTO_RSV_ELI-406-01.json | 0 .../AUTO_RSV_ELI-406_001.json | 0 .../AUTO_RSV_ELI-406_002.json | 0 .../AUTO_RSV_ELI-406_003.json | 0 .../AUTO_RSV_VITA_INT_008.json | 39 ---------------- .../AUTO_RSV_ELI-406_001.json | 0 .../AUTO_RSV_ELI-406_002.json | 0 .../AUTO_RSV_ELI-406_003.json | 0 .../AUTO_RSV_VITA_INT_008.json | 37 ---------------- tests/e2e/tests/test_error_scenario_tests.py | 44 +++++++------------ 10 files changed, 17 insertions(+), 103 deletions(-) rename tests/e2e/data/configs/{inProgressTestConfigs => storyTestConfigs}/AUTO_RSV_ELI-406-01.json (100%) rename tests/e2e/data/dynamoDB/{inProgressTestData => storyTestData}/AUTO_RSV_ELI-406_001.json (100%) rename tests/e2e/data/dynamoDB/{inProgressTestData => storyTestData}/AUTO_RSV_ELI-406_002.json (100%) rename tests/e2e/data/dynamoDB/{inProgressTestData => storyTestData}/AUTO_RSV_ELI-406_003.json (100%) delete mode 100644 tests/e2e/data/dynamoDB/vitaIntegrationTestData/AUTO_RSV_VITA_INT_008.json rename tests/e2e/data/responses/{inProgressTestResponses => storyTestResponses}/AUTO_RSV_ELI-406_001.json (100%) rename tests/e2e/data/responses/{inProgressTestResponses => storyTestResponses}/AUTO_RSV_ELI-406_002.json (100%) rename tests/e2e/data/responses/{inProgressTestResponses => storyTestResponses}/AUTO_RSV_ELI-406_003.json (100%) delete mode 100644 tests/e2e/data/responses/vitaIntegrationTestResponses/AUTO_RSV_VITA_INT_008.json diff --git a/tests/e2e/data/configs/inProgressTestConfigs/AUTO_RSV_ELI-406-01.json b/tests/e2e/data/configs/storyTestConfigs/AUTO_RSV_ELI-406-01.json similarity index 100% rename from tests/e2e/data/configs/inProgressTestConfigs/AUTO_RSV_ELI-406-01.json rename to tests/e2e/data/configs/storyTestConfigs/AUTO_RSV_ELI-406-01.json diff --git a/tests/e2e/data/dynamoDB/inProgressTestData/AUTO_RSV_ELI-406_001.json b/tests/e2e/data/dynamoDB/storyTestData/AUTO_RSV_ELI-406_001.json similarity index 100% rename from tests/e2e/data/dynamoDB/inProgressTestData/AUTO_RSV_ELI-406_001.json rename to tests/e2e/data/dynamoDB/storyTestData/AUTO_RSV_ELI-406_001.json diff --git a/tests/e2e/data/dynamoDB/inProgressTestData/AUTO_RSV_ELI-406_002.json b/tests/e2e/data/dynamoDB/storyTestData/AUTO_RSV_ELI-406_002.json similarity index 100% rename from tests/e2e/data/dynamoDB/inProgressTestData/AUTO_RSV_ELI-406_002.json rename to tests/e2e/data/dynamoDB/storyTestData/AUTO_RSV_ELI-406_002.json diff --git a/tests/e2e/data/dynamoDB/inProgressTestData/AUTO_RSV_ELI-406_003.json b/tests/e2e/data/dynamoDB/storyTestData/AUTO_RSV_ELI-406_003.json similarity index 100% rename from tests/e2e/data/dynamoDB/inProgressTestData/AUTO_RSV_ELI-406_003.json rename to tests/e2e/data/dynamoDB/storyTestData/AUTO_RSV_ELI-406_003.json diff --git a/tests/e2e/data/dynamoDB/vitaIntegrationTestData/AUTO_RSV_VITA_INT_008.json b/tests/e2e/data/dynamoDB/vitaIntegrationTestData/AUTO_RSV_VITA_INT_008.json deleted file mode 100644 index 1ff7adb41..000000000 --- a/tests/e2e/data/dynamoDB/vitaIntegrationTestData/AUTO_RSV_VITA_INT_008.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "scenario_name": "RSV - Vita Integration - NotActionable - empty suggestions - fallback to static", - "request_headers": { - "nhs-login-nhs-number": "9658219004" - }, - "config_filenames": [ - "vita_integration_test_config.json" - ], - "data": [ - { - "NHS_NUMBER": "9658219004", - "ATTRIBUTE_TYPE": "COHORTS", - "COHORT_MEMBERSHIPS": [ - { - "COHORT_LABEL": "rsv_75to79", - "DATE_JOINED": "20231020" - } - ] - }, - { - "NHS_NUMBER": "9658219004", - "ATTRIBUTE_TYPE": "PERSON", - "DATE_OF_BIRTH": "19500601", - "GENDER": "2", - "POSTCODE": "CB3 8DX", - "POSTCODE_SECTOR": "CB38", - "POSTCODE_OUTCODE": "CB3", - "MSOA": "E02007085", - "LSOA": "E01018223", - "GP_PRACTICE_CODE": "D81046", - "PCN": "U75549", - "ICB": "QUE", - "COMMISSIONING_REGION": "Y61", - "13Q_FLAG": "N", - "CARE_HOME_FLAG": "N", - "DE_FLAG": "N" - } - ] -} diff --git a/tests/e2e/data/responses/inProgressTestResponses/AUTO_RSV_ELI-406_001.json b/tests/e2e/data/responses/storyTestResponses/AUTO_RSV_ELI-406_001.json similarity index 100% rename from tests/e2e/data/responses/inProgressTestResponses/AUTO_RSV_ELI-406_001.json rename to tests/e2e/data/responses/storyTestResponses/AUTO_RSV_ELI-406_001.json diff --git a/tests/e2e/data/responses/inProgressTestResponses/AUTO_RSV_ELI-406_002.json b/tests/e2e/data/responses/storyTestResponses/AUTO_RSV_ELI-406_002.json similarity index 100% rename from tests/e2e/data/responses/inProgressTestResponses/AUTO_RSV_ELI-406_002.json rename to tests/e2e/data/responses/storyTestResponses/AUTO_RSV_ELI-406_002.json diff --git a/tests/e2e/data/responses/inProgressTestResponses/AUTO_RSV_ELI-406_003.json b/tests/e2e/data/responses/storyTestResponses/AUTO_RSV_ELI-406_003.json similarity index 100% rename from tests/e2e/data/responses/inProgressTestResponses/AUTO_RSV_ELI-406_003.json rename to tests/e2e/data/responses/storyTestResponses/AUTO_RSV_ELI-406_003.json diff --git a/tests/e2e/data/responses/vitaIntegrationTestResponses/AUTO_RSV_VITA_INT_008.json b/tests/e2e/data/responses/vitaIntegrationTestResponses/AUTO_RSV_VITA_INT_008.json deleted file mode 100644 index 8c12bd373..000000000 --- a/tests/e2e/data/responses/vitaIntegrationTestResponses/AUTO_RSV_VITA_INT_008.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "scenario_name": "RSV - Vita Integration - NotActionable - empty suggestions - fallback to static", - "request_headers": { - "nhs-login-nhs-number": "9658219004" - }, - "config_filename": "vita_integration_test_config.json", - "data": [ - { - "NHS_NUMBER": "9658219004", - "ATTRIBUTE_TYPE": "COHORTS", - "COHORT_MEMBERSHIPS": [ - { - "COHORT_LABEL": "rsv_75_rolling", - "DATE_JOINED": "20231020" - } - ] - }, - { - "NHS_NUMBER": "9658219004", - "ATTRIBUTE_TYPE": "PERSON", - "DATE_OF_BIRTH": "19500601", - "GENDER": "2", - "POSTCODE": "CB3 8DX", - "POSTCODE_SECTOR": "CB38", - "POSTCODE_OUTCODE": "CB3", - "MSOA": "E02007085", - "LSOA": "E01018223", - "GP_PRACTICE_CODE": "D81046", - "PCN": "U75549", - "ICB": "QUE", - "COMMISSIONING_REGION": "Y61", - "13Q_FLAG": "N", - "CARE_HOME_FLAG": "N", - "DE_FLAG": "N" - } - ] -} diff --git a/tests/e2e/tests/test_error_scenario_tests.py b/tests/e2e/tests/test_error_scenario_tests.py index aade6374d..0174cc324 100644 --- a/tests/e2e/tests/test_error_scenario_tests.py +++ b/tests/e2e/tests/test_error_scenario_tests.py @@ -26,8 +26,8 @@ def test_check_for_missing_person(eligibility_client): "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", "code": "REFERENCE_NOT_FOUND", "display": "The given NHS number was not found in our datasets. " - "This could be because the number is incorrect or some other reason " - "we cannot process that number.", + "This could be because the number is incorrect or some other reason " + "we cannot process that number.", } ] }, @@ -67,8 +67,8 @@ def test_check_for_missing_person(eligibility_client): "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", "code": "REFERENCE_NOT_FOUND", "display": "The given NHS number was not found in our datasets. " - "This could be because the number is incorrect or some other reason we " - "cannot process that number.", + "This could be because the number is incorrect or some other reason we " + "cannot process that number.", } ] }, @@ -91,17 +91,12 @@ def test_check_for_missing_person(eligibility_client): { "severity": "error", "code": "forbidden", - "details": { - "coding": [ - { - "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", - "code": "INVALID_NHS_NUMBER", - "display": "The provided NHS number does not match the record.", - } - ] - }, - "diagnostics": "NHS Number 9934567890 does not match the header NHS Number 99345678900", - "location": ["parameters/id"], + "details": {"coding": [{"code": "ACCESS_DENIED", + "display": "Access has been denied to " + "process this request.", + "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"}]}, + "diagnostics": "You are not authorised to request information for " + "the supplied NHS Number" } ], }, @@ -119,17 +114,12 @@ def test_check_for_missing_person(eligibility_client): { "severity": "error", "code": "forbidden", - "details": { - "coding": [ - { - "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", - "code": "INVALID_NHS_NUMBER", - "display": "The provided NHS number does not match the record.", - } - ] - }, - "diagnostics": "NHS Number 1234567890 does not match the header NHS Number ", - "location": ["parameters/id"], + "details": {"coding": [{"code": "ACCESS_DENIED", + "display": "Access has been denied to " + "process this request.", + "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"}]}, + "diagnostics": "You are not authorised to request information for " + "the supplied NHS Number" } ], }, @@ -174,7 +164,7 @@ def test_nhs_login_header_handling(eligibility_client, test_case): ] }, "diagnostics": "covid-rsv should be a single or comma separated list of condition strings " - "with no other punctuation or special characters", + "with no other punctuation or special characters", "location": ["parameters/conditions"], "severity": "error", } From ce418ef1cfd9a69855b0ed8ef622c99c8beabea7 Mon Sep 17 00:00:00 2001 From: SeanSteberis <103416906+seansteberisal@users.noreply.github.com> Date: Tue, 12 Aug 2025 16:18:06 +0100 Subject: [PATCH 2/2] formatting added new make target that will format and lint in 1 command --- Makefile | 2 + tests/e2e/tests/test_error_scenario_tests.py | 42 ++++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index d96c6f18d..e28f0fe60 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,8 @@ format: ## Format and fix code poetry run ruff format . poetry run ruff check . --fix-only +format_lint: format lint + #Files to loop over in release _dist_include="pytest.ini poetry.lock poetry.toml pyproject.toml Makefile build/. tests" diff --git a/tests/e2e/tests/test_error_scenario_tests.py b/tests/e2e/tests/test_error_scenario_tests.py index 0174cc324..b9bc76613 100644 --- a/tests/e2e/tests/test_error_scenario_tests.py +++ b/tests/e2e/tests/test_error_scenario_tests.py @@ -26,8 +26,8 @@ def test_check_for_missing_person(eligibility_client): "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", "code": "REFERENCE_NOT_FOUND", "display": "The given NHS number was not found in our datasets. " - "This could be because the number is incorrect or some other reason " - "we cannot process that number.", + "This could be because the number is incorrect or some other reason " + "we cannot process that number.", } ] }, @@ -67,8 +67,8 @@ def test_check_for_missing_person(eligibility_client): "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", "code": "REFERENCE_NOT_FOUND", "display": "The given NHS number was not found in our datasets. " - "This could be because the number is incorrect or some other reason we " - "cannot process that number.", + "This could be because the number is incorrect or some other reason we " + "cannot process that number.", } ] }, @@ -91,12 +91,16 @@ def test_check_for_missing_person(eligibility_client): { "severity": "error", "code": "forbidden", - "details": {"coding": [{"code": "ACCESS_DENIED", - "display": "Access has been denied to " - "process this request.", - "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"}]}, - "diagnostics": "You are not authorised to request information for " - "the supplied NHS Number" + "details": { + "coding": [ + { + "code": "ACCESS_DENIED", + "display": "Access has been denied to process this request.", + "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", + } + ] + }, + "diagnostics": "You are not authorised to request information for the supplied NHS Number", } ], }, @@ -114,12 +118,16 @@ def test_check_for_missing_person(eligibility_client): { "severity": "error", "code": "forbidden", - "details": {"coding": [{"code": "ACCESS_DENIED", - "display": "Access has been denied to " - "process this request.", - "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1"}]}, - "diagnostics": "You are not authorised to request information for " - "the supplied NHS Number" + "details": { + "coding": [ + { + "code": "ACCESS_DENIED", + "display": "Access has been denied to process this request.", + "system": "https://fhir.nhs.uk/STU3/ValueSet/Spine-ErrorOrWarningCode-1", + } + ] + }, + "diagnostics": "You are not authorised to request information for the supplied NHS Number", } ], }, @@ -164,7 +172,7 @@ def test_nhs_login_header_handling(eligibility_client, test_case): ] }, "diagnostics": "covid-rsv should be a single or comma separated list of condition strings " - "with no other punctuation or special characters", + "with no other punctuation or special characters", "location": ["parameters/conditions"], "severity": "error", }