Skip to content

Commit

Permalink
Added tests back
Browse files Browse the repository at this point in the history
  • Loading branch information
helen-brown committed Sep 28, 2023
1 parent cdad595 commit 7c1e9d6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 23 deletions.
2 changes: 1 addition & 1 deletion azure/components/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ steps:
export SERVICE_BASE_PATH="$(SERVICE_BASE_PATH)"
export STATUS_ENDPOINT_API_KEY="$(status-endpoint-api-key)"
export APIGEE_PRODUCT="$(FULLY_QUALIFIED_SERVICE_NAME)"
export OAUTH_PROXY="oauth2-mock"
export OAUTH_PROXY="oauth2"
export OAUTH_BASE_URI="https://$(ENVIRONMENT).api.service.nhs.uk"
export JWT_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(JWT_TESTING_PRIVATE_KEY)"
export ID_TOKEN_NHS_LOGIN_PRIVATE_KEY_ABSOLUTE_PATH="$(Pipeline.Workspace)/secrets/$(ID_TOKEN_NHS_LOGIN_PRIVATE_KEY)"
Expand Down
2 changes: 1 addition & 1 deletion manifest_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DESCRIPTION: Immunisation history API
APIGEE_ENVIRONMENTS:
- name: internal-dev
display_name: Internal Development
has_mock_auth: true
has_mock_auth: false
- name: internal-dev-sandbox
display_name: Internal Development Sandbox
- name: internal-qa
Expand Down
29 changes: 8 additions & 21 deletions tests/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def test_check_immunization_is_secured(service_url):
assert resp.status_code == 401


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -111,7 +110,6 @@ def test_client_credentials_happy_path(immunisation_history_app: Dict, service_u
assert len(body["entry"]) == 3, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.asyncio
@pytest.mark.parametrize(
Expand Down Expand Up @@ -146,7 +144,6 @@ async def test_immunization_no_auth_bearer_token_provided(
], body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.asyncio
@pytest.mark.parametrize(
Expand All @@ -169,7 +166,7 @@ async def test_bad_nhs_number(immunisation_history_app: Dict, service_url: str,
"identity_proofing_level": immunisation_history_app["request_params"]["identity_proofing_level"]
}
token_response = conftest.get_token_nhs_login_token_exchange(
immunisation_history_app, subject_token_claims=subject_token_claims
test_app=immunisation_history_app, environment=environment, subject_token_claims=subject_token_claims
)
token = token_response["access_token"]
correlation_id = _generate_correlation_id('test_bad_nhs_number')
Expand Down Expand Up @@ -211,7 +208,6 @@ def test_correlation_id_mirrored_in_resp_when_error(service_url):
assert resp.headers["x-correlation-id"] == correlation_id, resp.headers


@pytest.mark.skip(reason="running cut down version while sorting out tests")
# TODO Fix
@pytest.mark.e2e
@pytest.mark.parametrize(
Expand Down Expand Up @@ -257,7 +253,7 @@ def test_token_exchange_happy_path(immunisation_history_app: Dict, service_url:
"identity_proofing_level": immunisation_history_app["request_params"]["identity_proofing_level"]
}
token_response = conftest.get_token_nhs_login_token_exchange(
immunisation_history_app, subject_token_claims=subject_token_claims
test_app=immunisation_history_app, environment=environment, subject_token_claims=subject_token_claims
)
token = token_response["access_token"]

Expand All @@ -275,7 +271,6 @@ def test_token_exchange_happy_path(immunisation_history_app: Dict, service_url:
assert len(body["entry"]) == 3, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
# TODO Fix
@pytest.mark.e2e
@pytest.mark.parametrize(
Expand All @@ -301,17 +296,17 @@ def test_token_exchange_happy_path(immunisation_history_app: Dict, service_url:
),
indirect=True,
)
def test_token_exchange_sad_path(immunisation_history_app):
def test_token_exchange_sad_path(immunisation_history_app: Dict, environment: str):
subject_token_claims = {
"identity_proofing_level": immunisation_history_app["request_params"]["identity_proofing_level"]
}
conftest.check_for_unauthorised_token_exchange(
immunisation_history_app, subject_token_claims=subject_token_claims
test_app=immunisation_history_app, environment=environment, subject_token_claims=subject_token_claims
)


@pytest.mark.skip(reason="running cut down version while sorting out tests")
# TODO Fix
@pytest.mark.skip(reason="Focussing on other broken tests")
@pytest.mark.e2e
@pytest.mark.asyncio
@pytest.mark.parametrize(
Expand Down Expand Up @@ -361,8 +356,8 @@ async def test_user_restricted_access_not_permitted(test_product_and_app, servic
assert body["issue"][0]["code"] == "forbidden"


@pytest.mark.skip(reason="running cut down version while sorting out tests")
# TODO Fix
@pytest.mark.skip(reason="Focussing on other broken tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"test_product_and_app",
Expand All @@ -382,13 +377,13 @@ async def test_user_restricted_access_not_permitted(test_product_and_app, servic
),
indirect=True,
)
def test_token_exchange_invalid_identity_proofing_level_scope(test_product_and_app, service_url):
def test_token_exchange_invalid_identity_proofing_level_scope(test_product_and_app, service_url: str, environment: str):
test_product, test_app = test_product_and_app
subject_token_claims = {
"identity_proofing_level": test_app["request_params"]["identity_proofing_level"]
}
token_response = conftest.get_token_nhs_login_token_exchange(
test_app, subject_token_claims=subject_token_claims
test_app=test_app, environment=environment, subject_token_claims=subject_token_claims
)
token = token_response["access_token"]

Expand Down Expand Up @@ -441,7 +436,6 @@ def test_pass_when_auth_targets_is_null(immunisation_history_app: Dict, service_
assert resp.status_code == 200, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -478,7 +472,6 @@ def test_fail_when_auth_targets_is_null_in_strict_mode(
}


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -518,7 +511,6 @@ def test_fail_when_auth_targets_is_blank_or_invalid(
assert resp.status_code == 401, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -547,7 +539,6 @@ def test_pass_when_auth_targets_is_star_in_non_strict_mode(
assert resp.status_code == 200, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -577,7 +568,6 @@ def test_fail_when_auth_targets_is_star_in_strict_mode(
assert resp.status_code == 403, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -613,7 +603,6 @@ def test_fail_when_authorised_targets_header_upper_set_in_good_request(
}


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -645,7 +634,6 @@ def test_immunization_target_happy_path(immunisation_history_app: Dict, immuniza
assert resp.status_code == 200, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -677,7 +665,6 @@ def test_immunization_target_unhappy_path(immunisation_history_app: Dict, immuni
assert resp.status_code == 400, body


@pytest.mark.skip(reason="running cut down version while sorting out tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def check_for_unauthorised_headers(client_app: Dict, environment: str):

def get_token_nhs_login_token_exchange(
test_app,
environment: str,
subject_token_claims: Dict = None
):
"""Call identity server to get an access token"""
Expand Down Expand Up @@ -178,6 +179,7 @@ def get_token_nhs_login_token_exchange(

def check_for_unauthorised_token_exchange(
test_app,
environment: str,
subject_token_claims: Dict = None
):
"""Call identity server to get an access token"""
Expand Down

0 comments on commit 7c1e9d6

Please sign in to comment.