Skip to content

Commit 0907a5b

Browse files
authored
Merge pull request #34 from NHSDigital/APM-6127-refactor-tests-to-use-test-utils-2
APM-6127 refactor tests to use pytest nhsd apim package
2 parents cd01b4d + d0f0889 commit 0907a5b

12 files changed

Lines changed: 924 additions & 1391 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
23
bin/
34
dist/
45
build/
@@ -12,5 +13,6 @@ __pycache__/
1213
.envrc
1314
.idea/
1415
.venv/
16+
.direnv/
1517

1618
smoketest-report.xml

Makefile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,18 @@ release: clean publish build-proxy
4545
mkdir -p dist
4646
for f in $(_dist_include); do cp -r $$f dist; done
4747

48+
TEST_CMD := @APIGEE_ACCESS_TOKEN=$(APIGEE_ACCESS_TOKEN) \
49+
poetry run pytest -v \
50+
--color=yes \
51+
--api-name=splunk-monitor \
52+
--proxy-name=$(PROXY_NAME) \
53+
-s
54+
4855
test:
49-
# this target should be used for local unit tests .. runs as part of the build pipeline
50-
make --no-print-directory -C test
56+
$(TEST_CMD) \
57+
--junitxml=test-report.xml \
5158

5259
smoketest:
53-
# this target is for end to end smoketests this would be run 'post deploy' to verify an environment is working
54-
poetry run pytest -v --junitxml=smoketest-report.xml -s -m smoketest
60+
$(TEST_CMD) \
61+
--junitxml=smoketest-report.xml \
62+
-m smoketest

azure/templates/run-smoke-tests.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ steps:
55
displayName: Setup pytests
66
77
- bash: |
8-
export RELEASE_RELEASEID=$(Build.BuildId)
9-
export SOURCE_COMMIT_ID=$(Build.SourceVersion)
10-
export APIGEE_ENVIRONMENT="$(ENVIRONMENT)"
11-
export SERVICE_BASE_PATH="$(SERVICE_BASE_PATH)"
12-
export STATUS_ENDPOINT_API_KEY="$(status-endpoint-api-key)"
8+
export PROXY_NAME="$(FULLY_QUALIFIED_SERVICE_NAME)"
9+
export APIGEE_ACCESS_TOKEN="$(secret.AccessToken)"
10+
export SOURCE_COMMIT_ID="$(Build.SourceVersion)"
1311
1412
make smoketest
1513
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)

poetry.lock

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

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ package-mode = false
1515

1616
[tool.poetry.dependencies]
1717
python = "^3.9"
18+
pytest-nhsd-apim = "^4.0.1"
19+
requests = "^2.32.3"
1820

1921
[tool.poetry.group.dev.dependencies]
2022
flake8 = "^7.1.2"
@@ -26,10 +28,9 @@ docopt = "^0.6.2"
2628
jsonpath-rw = "^1.4.0"
2729
semver = "^3.0.2"
2830
gitpython = "^3.1.34"
29-
pytest = "^6.1.2"
31+
pytest = "^8.2.0"
3032
coverage = "^5.5"
3133
aiohttp = "^3.10.11"
3234
pytest-asyncio = "^0.14.0"
33-
api-test-utils = {url = "https://github.com/NHSDigital/apim-test-utils/releases/download/v1.1.43-alpha/api_test_utils-1.1.43a0-py3-none-any.whl"}
3435

3536
[tool.poetry.scripts]

tests/__init__.py

Whitespace-only changes.

tests/api_tests.py

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

tests/configuration/__init__.py

Whitespace-only changes.

tests/configuration/config.py

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

tests/configuration/environment.py

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

0 commit comments

Comments
 (0)