Skip to content

Commit b9ef4d4

Browse files
adam-wallernhs1seansteberisalshweta-nhsayeshalshukri1-nhsrobbailiff2
authored
test/test-api (#197)
* test_smoke_tests.py created * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * .gitignore and small change to test * tidy before push * linting changes and s3configmanager update * removal of common helpers * MORE TIDYING * added and updated story test for ELI-155 and ELI-291 * added and updated story test for ELI-155 and ELI-291 * some linting fixes * adding header functionality to the GET request * adding header functionality to the GET request * adding header functionality to the GET request * adding new scenarios * updates to fix 90+ formatting and linting issues :) * test_smoke_tests.py created * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * moved more files * .gitignore and small change to test * tidy before push * linting changes and s3configmanager update * removal of common helpers * MORE TIDYING * added and updated story test for ELI-155 and ELI-291 * added and updated story test for ELI-155 and ELI-291 * some linting fixes * adding header functionality to the GET request * adding header functionality to the GET request * adding header functionality to the GET request * adding new scenarios * updates to fix 90+ formatting and linting issues :) * updates * updates * tidying of data files and responses and some refactoring. * addition of more data files and the functionality to include query_params * addition of more data files and clean up of how to deal with dynamic data * additional error scenarios and lots more data changes and refactoring * eli-320 cases added * eli-295 cases added and some refactoring * eli-222 cases * eli-295 cases * eli-221 cases * Added a WEEK Case to _resolve_placeholder_value updated "Type": "M" to "Type": "O" in a number of config files Added ELI-236 Scenarios Extend functionality to add placeholder values in the configs to support offset and NVL * sean demo tests * Lots of new scenarios and scenario updates * added vita int tests, ELI-365, * updated configs for 311 for. added ability to assert the response code in the tests * removed some breaking code * ELI-320 new sceanrio * added the in progress test * added ELI-399 regression tests tidying the VITA int tests removed 320-12 as invalid * added ELI-399, 373 regression tests tidying the VITA int tests removed 320-12 as invalid * added ELI-399, 373 regression tests tidying the VITA int tests removed 320-12 as invalid removed old code added Sean handover stuff * ELI-365 - over 80s (#288) * ELI-318: Adds content-type in 404 and 500 error response (#232) * ELI-294: Personalised/customised status text (#234) * ELI-294: Personalised/customised status text * ELI-294: Personalised/customised status text * ELI-294: Adds unit tests for Status Enum * ELI-294: Fix sonar issues * ELI-318: Adds application/fhir+json as valid mime type in Mangum (#235) * ELI-331: Mask PII/GDPR info (#239) * ELI-331: Mask PII/GDPR info * ELI-331: Fix formatting * ELI-331: Fix format and lint * Revert "ELI-331: Mask PII/GDPR info (#239)" (#240) This reverts commit 14d6a5e. * Feature/eli 295 generic text for not eligible xrules (#238) * WIP: drafting out X and Y rules. * WIP: updated config with x and y rule idea. * WIP: Stub out x and y rules impl * WIP: stubbing out impl. * Refactored action support functions and renamed vars * WIP: Added X/Y Rule logic and test. * Added tests for eligible and actionable actions. * WIP: Added more tests for X and Y rule scenarios. * WIP: flaky tests. * WIP: Fixed failing tests for empty actions. * WIP: added audit record check to tests. * WIP: file format and added audit rule priority and name test. * Working tests. Refactored some audit logic. * Minor refactor * Addressed linting issues * WIP: fixed failing unit tests. * Format. * Added tests. * File format --------- Co-authored-by: Robert <[email protected]> * Bump polyfactory from 2.21.0 to 2.22.1 --- updated-dependencies: - dependency-name: polyfactory dependency-version: 2.22.1 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Revert "Bump polyfactory from 2.21.0 to 2.22.1" (#241) * Bump aiohttp from 3.12.13 to 3.12.14 --- updated-dependencies: - dependency-name: aiohttp dependency-version: 3.12.14 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <[email protected]> * provided appropriate values factory methods in tests (#245) * Refactor package structure (#247) * eli-343 following on from suggestions from AWS Security Hub, restricting access to public internet via Internet Gateway, and adding table protection in Prod for DynamoDB * add lambda request id in logs events (#248) * add lambda request id in logs events * linting fix * revoked custom formatter and reapplied JsonFormatter * revoked formatting * added wrapper for registering requestid * Adds unit tests for log format --------- Co-authored-by: Shweta <[email protected]> * Feature/rgjb aa eli 329 add xray tracing for lambda (#243) * Added xray permissions policy for lambda * Add xray vpc endpoint * Added xray to the permissions boundary * Added xray to the assumed role permissions boundary * Testing permission boundary. * testing perm bound. --------- Co-authored-by: ayeshalshukri1-nhs <[email protected]> * bugfix - Github action needs permission to modify public access block * bugfix - changing permission to be wildcard resource, as it's an account level permission * Added api gateway request id, moved request id logging to app.py (#252) * ELI-351 and ELI-342: Refactors and fixes Cohort Schema Mismatch (#253) * Adds campaign_evaluator and tests * Adds person_data_reader and tests * Injects person data reader and campaign processor into eligibility calculator * ELI-342 Dynamo Cohort Schema Mismatch * ELI-342: Fixes usage of person cohorts method and tests * Feature/eli 369 dynamodb x ray tracing (#256) * handled none headers from request * x-ray tracing setup for dynamo, s3, firehose * enable_xray_patching env variable for lambda * sonar fixes --------- Co-authored-by: karthikeyannhs <[email protected]> * Bump slackapi/slack-github-action from 2.1.0 to 2.1.1 Bumps [slackapi/slack-github-action](https://github.com/slackapi/slack-github-action) from 2.1.0 to 2.1.1. - [Release notes](https://github.com/slackapi/slack-github-action/releases) - [Commits](slackapi/slack-github-action@v2.1.0...v2.1.1) --- updated-dependencies: - dependency-name: slackapi/slack-github-action dependency-version: 2.1.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * ELI-351: Refactor (#254) * ELI-351: Renames rules model to campaign_config * ELI-351: Extracts Person data class * ELI-351: Adds rule processor * ELI-351: Adds tests for rule processor * ELI-351: Moves get_cohort_group_results to rule processor * ELI-351: Adds tests for rule processor * ELI-351: Adds cohort handler using Chain of responsibility pattern * ELI-351: Renames * ELI-351: Fixes lint * ELI-351: Renames evaluate_eligibility to get_eligibility_status * ELI-351: Refactoring to get better readability for chaining * ELI-351: Fix lint * Bump botocore from 1.38.42 to 1.38.46 Bumps [botocore](https://github.com/boto/botocore) from 1.38.42 to 1.38.46. - [Commits](boto/botocore@1.38.42...1.38.46) --- updated-dependencies: - dependency-name: botocore dependency-version: 1.38.46 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump moto from 5.1.6 to 5.1.9 Bumps [moto](https://github.com/getmoto/moto) from 5.1.6 to 5.1.9. - [Release notes](https://github.com/getmoto/moto/releases) - [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md) - [Commits](getmoto/moto@5.1.6...5.1.9) --- updated-dependencies: - dependency-name: moto dependency-version: 5.1.9 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump localstack from 4.5.0 to 4.6.0 Bumps [localstack](https://github.com/localstack/localstack) from 4.5.0 to 4.6.0. - [Release notes](https://github.com/localstack/localstack/releases) - [Commits](localstack/localstack@v4.5.0...v4.6.0) --- updated-dependencies: - dependency-name: localstack dependency-version: 4.6.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump pytest-asyncio from 1.0.0 to 1.1.0 --- updated-dependencies: - dependency-name: pytest-asyncio dependency-version: 1.1.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump pytest-docker from 3.2.2 to 3.2.3 Bumps [pytest-docker](https://github.com/avast/pytest-docker) from 3.2.2 to 3.2.3. - [Release notes](https://github.com/avast/pytest-docker/releases) - [Changelog](https://github.com/avast/pytest-docker/blob/master/CHANGELOG.md) - [Commits](avast/pytest-docker@v3.2.2...v3.2.3) --- updated-dependencies: - dependency-name: pytest-docker dependency-version: 3.2.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * ELI-351: Refactor (#258) * ELI-351: Refactor * ELI-351: Adds tests for action rule handler * ELI-351: Renames and fixes tests * ELI-351: Renames and fixes tests * Bump asgiref from 3.8.1 to 3.9.1 Bumps [asgiref](https://github.com/django/asgiref) from 3.8.1 to 3.9.1. - [Changelog](https://github.com/django/asgiref/blob/main/CHANGELOG.txt) - [Commits](django/asgiref@3.8.1...3.9.1) --- updated-dependencies: - dependency-name: asgiref dependency-version: 3.9.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump gitpython from 3.1.44 to 3.1.45 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.44 to 3.1.45. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](gitpython-developers/GitPython@3.1.44...3.1.45) --- updated-dependencies: - dependency-name: gitpython dependency-version: 3.1.45 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump pyright from 1.1.402 to 1.1.403 Bumps [pyright](https://github.com/RobertCraigie/pyright-python) from 1.1.402 to 1.1.403. - [Release notes](https://github.com/RobertCraigie/pyright-python/releases) - [Commits](RobertCraigie/pyright-python@v1.1.402...v1.1.403) --- updated-dependencies: - dependency-name: pyright dependency-version: 1.1.403 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * ELI-351: Moves/deletes tests after refactoring (#265) * ELI-351: Moves/deletes tests after refactoring * ELI-351: Extracts EligibilityResultBuilder and adds tests * ELI-351: De-extracts EligibilityResultBuilder and moves tests to Eligibility Calculator tests * ELI-351: Removes duplicated tests * ELI-351: Removes duplicated tests #2 * ELI-351: Adds validation and audit layer to Readme * Bump aiohttp from 3.12.14 to 3.12.15 --- updated-dependencies: - dependency-name: aiohttp dependency-version: 3.12.15 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * trying an approach to ensure correct version of python used in lambda build (#271) * ELI-311: Campaign Config Data Type Changes (#269) * eli-285 and eli-349 adding cloudwatch alarms for a) security and b) ops - API Gateway and Lambda execution * eli-285 - disabling action on API calls as our internal security are triggering this * eli-285 and 349 adding kms for sns, checkov skip for disabled alarms * work in progress * eli-285 enable kms key rotation * eli-285 get rid of false flag gitleak * eli-388 adding access log permissions for audit buckets * eli-386 blocking s3 public access at account level * ELI-376: Audit record should log multiple F and S rules (#275) * ELI-376: Audit record should log multiple F and S rules * ELI-376: Fixing int test * ELI-150: campaign config validation (#264) * validations - wip * iteration validation * iteration rules * campaign config validation * made BUC tests bit more clear * Renaming for clarity. * lint and formatting fixes. * wip * Integration Rules Test * Actions mapper validator * Iterations BUC * available_actions tests * lint fixes * lint fixes * Bump asgiref from 3.8.1 to 3.9.1 Bumps [asgiref](https://github.com/django/asgiref) from 3.8.1 to 3.9.1. - [Changelog](https://github.com/django/asgiref/blob/main/CHANGELOG.txt) - [Commits](django/asgiref@3.8.1...3.9.1) --- updated-dependencies: - dependency-name: asgiref dependency-version: 3.9.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> * Bump gitpython from 3.1.44 to 3.1.45 Bumps [gitpython](https://github.com/gitpython-developers/GitPython) from 3.1.44 to 3.1.45. - [Release notes](https://github.com/gitpython-developers/GitPython/releases) - [Changelog](https://github.com/gitpython-developers/GitPython/blob/main/CHANGES) - [Commits](gitpython-developers/GitPython@3.1.44...3.1.45) --- updated-dependencies: - dependency-name: gitpython dependency-version: 3.1.45 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * Bump pyright from 1.1.402 to 1.1.403 Bumps [pyright](https://github.com/RobertCraigie/pyright-python) from 1.1.402 to 1.1.403. - [Release notes](https://github.com/RobertCraigie/pyright-python/releases) - [Commits](RobertCraigie/pyright-python@v1.1.402...v1.1.403) --- updated-dependencies: - dependency-name: pyright dependency-version: 1.1.403 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> * ELI-351: Moves/deletes tests after refactoring (#265) * ELI-351: Moves/deletes tests after refactoring * ELI-351: Extracts EligibilityResultBuilder and adds tests * ELI-351: De-extracts EligibilityResultBuilder and moves tests to Eligibility Calculator tests * ELI-351: Removes duplicated tests * ELI-351: Removes duplicated tests #2 * ELI-351: Adds validation and audit layer to Readme * wip - has failing tests * test fixed and lint error fixed * warning fixed * rules validation added * test commit * tests updated w.r.t to datatype changes from main * updated output message * arguments added to app.py * sonar fix * sonar fix * sonar fix --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: karthikeyannhs <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Shweta <[email protected]> * eli-386 adding github permissions to make account level public access block changes * all tests passing * Revert "eli-386 blocking s3 public access at account level" * extracting method for readability * ELI-399: Fixing Future Iteration.StartDate Resulting in 500 Error (#282) * ELI-399: Fixing Future Iteration.StartDate Resulting in 500 Error * ELI-399: Adds empty rules to fix flakiness * applying to filter rules and adding test * ELI-397: Fixing nhs number missing from path error to be FHIR compliant (#284) * Added new tests updated poetry version * ELI-399: Fixing start date validation (#287) * ELI-399: Fixing start date validation * ELI-399: Fixing annotation * ELI-328: cohort validations (#281) * test action mapper doesn't accept invalid actions * Attribute level and name relations when it is cohort * added iteration_cohorts_validation * chainging the validations * fix * fix * fix lint * fix lint * lint fixes * lint fixes * test fixes * lint fixes * Removed defaultcomms from iteration level of test config. * Reorder feilds in config. * Update to config. * default comm routing validation * unit tests default comm routing validation * default comm routing validation in rules * lint fixes * test data fixed * grouped model validators --------- Co-authored-by: ayeshalshukri1-nhs <[email protected]> * fixed new tests * ELI-404: Fix Error message returned for authorisation failure (#289) * ELI-404: Fix Error message returned for authorisation failure * ELI-404: Fix sonar * update packages * Bugfix to change response grouping from name to priority (#286) * changed grouping from name to priority * changed grouping from name to priority, type * sonar code complexity fix * sonar code complexity fix * updated names in the code for better clarity * regroup the suitability tests * fix - ordering regroup the suitability tests * test for cohort groups --------- Co-authored-by: karthikeyannhs <[email protected]> * ELI-397: AWS api gateway to handle bad request param error (#291) * Changes to tests added 1 more test fixed 365 config to work with all test cases * linting and formatting update package updates --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Shweta <[email protected]> Co-authored-by: ayeshalshukri1-nhs <[email protected]> Co-authored-by: Robert <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: eddalmond1 <[email protected]> Co-authored-by: Karthikeyannhs <[email protected]> Co-authored-by: eddalmond1 <[email protected]> Co-authored-by: TOEL2 <[email protected]> * added ELI-399, 373 regression tests tidying the VITA int tests removed 320-12 as invalid removed old code added Sean handover stuff * added ELI-399, 373 regression tests tidying the VITA int tests removed 320-12 as invalid removed old code added Sean handover stuff refomatting to pass checks * added ELI-399, 373 regression tests tidying the VITA int tests removed 320-12 as invalid removed old code added Sean handover stuff refomatting to pass checks *2 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Sean Steberis <[email protected]> Co-authored-by: Shweta <[email protected]> Co-authored-by: ayeshalshukri1-nhs <[email protected]> Co-authored-by: Robert <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: eddalmond1 <[email protected]> Co-authored-by: Karthikeyannhs <[email protected]> Co-authored-by: eddalmond1 <[email protected]> Co-authored-by: TOEL2 <[email protected]>
1 parent 5fb57a7 commit b9ef4d4

File tree

415 files changed

+22230
-1632
lines changed

Some content is hidden

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

415 files changed

+22230
-1632
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,5 @@ sandbox/specification/*
4848
/specification/tmp/*
4949
/tests/e2e/data/out*
5050
/tests/e2e/reports/*
51+
/tests/e2e/.temp/
52+
/tests/e2e/certs/

.tool-versions

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
terraform 1.12.1
44
pre-commit 4.2.0
55
vale 3.11.2
6-
poetry 2.1.3
6+
poetry 2.1.4
77
act 0.2.77
8+
nodejs 22.18.0
89

910
# ==============================================================================
1011
# The section below is reserved for Docker image versions.

poetry.lock

Lines changed: 105 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jsonschema = "^4.24.0"
6363
behave = "^1.2.6"
6464
boto3 = "^1.38.42"
6565
python-dotenv = "^1.1.1"
66+
openapi-spec-validator = "^0.7.2"
6667

6768
[tool.poetry-plugin-lambda-build]
6869
docker-image = "public.ecr.aws/sam/build-python3.13:1.139-x86_64" # See https://gallery.ecr.aws/search?searchTerm=%22python%22&architecture=x86-64&popularRegistries=amazon&verified=verified&operatingSystems=Linux

pytest.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
[pytest]
22
python_files = *_tests.py test_*.py
33
norecursedirs = .venv .eggs build dist utils
4-
addopts = --strict-markers
4+
#addopts = --strict-markers
55
markers =
66
e2e: end to end tests
77
smoketest: suitable to run against all environments even production
8+
functionale2eregression: functional regression tests
9+
sandboxtests: tests to replicate example sandbox responses agreed with vita

tests/e2e/.env.example

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

tests/e2e/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ assets/
4242
# Logs
4343
*.log
4444
/helpers/output/
45+
/.hypothesis/unicode_data/15.1.0/charmap.json.gz
46+
/tests/.hypothesis/unicode_data/15.1.0/charmap.json.gz
21.2 KB
Binary file not shown.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"request": {
3+
"requestTimestamp": "2025-08-11 07:43:12.954767+00:00",
4+
"headers": {
5+
"xRequestId": null,
6+
"xCorrelationId": null,
7+
"nhsdEndUserOrganisationOds": null,
8+
"nhsdApplicationId": null
9+
},
10+
"queryParams": {
11+
"category": null,
12+
"conditions": null,
13+
"includeActions": null
14+
},
15+
"nhsNumber": "9900376001"
16+
},
17+
"response": {
18+
"responseId": "0300f1e8-6004-4229-a972-29220f08b8e9",
19+
"lastUpdated": "2025-08-11 07:43:13.267973+00:00",
20+
"condition": [
21+
{
22+
"campaignId": "AUTO_RSV_ELI-376-01-Campaign-ID",
23+
"campaignVersion": 1,
24+
"iterationId": "AUTO_RSV_ELI-376-01-Iteration-ID",
25+
"iterationVersion": 1,
26+
"conditionName": "RSV",
27+
"status": "actionable",
28+
"statusText": "You should have the RSV vaccine",
29+
"eligibilityCohorts": [
30+
{
31+
"cohortCode": "rsv_eli_376_cohort_1",
32+
"cohortStatus": "actionable"
33+
},
34+
{
35+
"cohortCode": "rsv_eli_376_cohort_2",
36+
"cohortStatus": "actionable"
37+
},
38+
{
39+
"cohortCode": "rsv_eli_376_cohort_3",
40+
"cohortStatus": "actionable"
41+
},
42+
{
43+
"cohortCode": "rsv_eli_376_cohort_4",
44+
"cohortStatus": "actionable"
45+
}
46+
],
47+
"eligibilityCohortGroups": [
48+
{
49+
"cohortCode": "rsv_eli_376_cohort_group",
50+
"cohortText": "are a member of eli_376_cohort_group_0",
51+
"cohortStatus": "actionable"
52+
},
53+
{
54+
"cohortCode": "rsv_eli_376_cohort_group",
55+
"cohortText": "are a member of eli_376_cohort_group_10",
56+
"cohortStatus": "actionable"
57+
},
58+
{
59+
"cohortCode": "rsv_eli_376_cohort_group",
60+
"cohortText": "are a member of eli_376_cohort_group_20",
61+
"cohortStatus": "actionable"
62+
},
63+
{
64+
"cohortCode": "rsv_eli_376_cohort_group_other",
65+
"cohortText": "are a member of eli_376_cohort_group_other",
66+
"cohortStatus": "actionable"
67+
}
68+
],
69+
"filterRules": null,
70+
"suitabilityRules": null,
71+
"actionRule": null,
72+
"actions": [
73+
{
74+
"internalActionCode": "TEST_ACTION",
75+
"actionType": "ButtonWithAuthLink",
76+
"actionCode": "TestAction",
77+
"actionDescription": "TestAction Description",
78+
"actionUrl": "http://www.nhs.uk/book-rsv",
79+
"actionUrlLabel": "Continue to booking"
80+
}
81+
]
82+
}
83+
]
84+
}
85+
}

0 commit comments

Comments
 (0)