Skip to content

Commit

Permalink
Revert back to using mock
Browse files Browse the repository at this point in the history
  • Loading branch information
helen-brown committed Sep 28, 2023
1 parent 5e9d90a commit 55992ea
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 30 deletions.
36 changes: 18 additions & 18 deletions azure/components/run-smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
steps:
- bash: |
export RELEASE_RELEASEID=$(Build.BuildId)
export SOURCE_COMMIT_ID=$(Build.SourceVersion)
export APIGEE_ENVIRONMENT="$(ENVIRONMENT)"
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"
export OAUTH_BASE_URI="https://$(ENVIRONMENT).api.service.nhs.uk"
make smoketest
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
displayName: run smoketests
- bash: |
export RELEASE_RELEASEID=$(Build.BuildId)
export SOURCE_COMMIT_ID=$(Build.SourceVersion)
export APIGEE_ENVIRONMENT="$(ENVIRONMENT)"
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_BASE_URI="https://$(ENVIRONMENT).api.service.nhs.uk"
make smoketest
workingDirectory: $(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)
displayName: run smoketests
- task: PublishTestResults@2
displayName: 'Publish smoketest results'
condition: always()
inputs:
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/smoketest-report.xml'
failTaskOnFailedTests: true
- task: PublishTestResults@2
displayName: 'Publish smoketest results'
condition: always()
inputs:
testResultsFiles: '$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/smoketest-report.xml'
failTaskOnFailedTests: true
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: false
has_mock_auth: true
- name: internal-dev-sandbox
display_name: Internal Development Sandbox
- name: internal-qa
Expand Down
4 changes: 1 addition & 3 deletions tests/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ def test_token_exchange_sad_path(immunisation_history_app: Dict, environment: st
)


# TODO Fix
@pytest.mark.skip(reason="Focussing on other broken tests")
# TODO FIX
@pytest.mark.e2e
@pytest.mark.asyncio
@pytest.mark.parametrize(
Expand Down Expand Up @@ -356,7 +355,6 @@ async def test_user_restricted_access_not_permitted(test_product_and_app, servic


# TODO Fix
@pytest.mark.skip(reason="Focussing on other broken tests")
@pytest.mark.e2e
@pytest.mark.parametrize(
"test_product_and_app",
Expand Down
17 changes: 9 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)

APP_EMAIL = "apm-testing-internal-dev@nhs.net"
ID_TOKEN_ISSUER = "https://identity.ptl.api.platform.nhs.uk/auth/realms/NHS-Login-mock-internal-dev"


def get_env(variable_name: str) -> str:
Expand Down Expand Up @@ -68,8 +69,8 @@ def nhs_login_id_token(
"id_status": "verified",
"token_use": "id",
"auth_time": 1616600683,
"iss": "https://internal-dev.api.service.nhs.uk", # Points to internal dev -> testing JWKS
"sub": "https://internal-dev.api.service.nhs.uk",
"iss": ID_TOKEN_ISSUER,
"sub": ID_TOKEN_ISSUER,
"exp": expires + 300,
"iat": expires - 10,
"vtm": "https://auth.sandpit.signin.nhs.uk/trustmark/auth.sandpit.signin.nhs.uk",
Expand All @@ -86,7 +87,7 @@ def nhs_login_id_token(
if id_token_claims is not None:
default_id_token_claims = {**default_id_token_claims, **id_token_claims}

default_id_token_headers = {"kid": "nhs-login", "typ": "JWT", "alg": "RS512"}
default_id_token_headers = {"kid": "B86zGrfcoloO13rnjKYDyAJcqj2iZAMrS49jyleL0Fo", "typ": "JWT", "alg": "RS512"}

if id_token_headers is not None:
default_id_token_headers = {**default_id_token_headers, **id_token_headers}
Expand All @@ -103,7 +104,7 @@ def get_token(
):
client_credentials_config = ClientCredentialsConfig(
environment=environment,
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2",
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2-mock",
client_id=app["credentials"][0]["consumerKey"],
jwt_private_key=app["app_jwt_private_key"],
jwt_kid="kid-1",
Expand All @@ -124,7 +125,7 @@ def check_for_unauthorised_headers(client_app: Dict, environment: str):
with pytest.raises(RuntimeError) as exc_info:
client_credentials_config = ClientCredentialsConfig(
environment=environment,
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2",
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2-mock",
client_id=client_app["credentials"][0]["consumerKey"],
jwt_private_key=client_app["app_jwt_private_key"],
jwt_kid="kid-1",
Expand Down Expand Up @@ -157,7 +158,7 @@ def get_token_nhs_login_token_exchange(
# When
config = TokenExchangeConfig(
environment=environment,
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2",
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2-mock",
client_id=test_app["credentials"][0]["consumerKey"],
jwt_private_key=test_app["app_jwt_private_key"],
jwt_kid="kid-1",
Expand Down Expand Up @@ -190,7 +191,7 @@ def check_for_unauthorised_token_exchange(
# When
config = TokenExchangeConfig(
environment=environment,
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2",
identity_service_base_url=f"https://{environment}.api.service.nhs.uk/oauth2-mock",
client_id=test_app["credentials"][0]["consumerKey"],
jwt_private_key=test_app["app_jwt_private_key"],
jwt_kid="kid-1",
Expand Down Expand Up @@ -305,7 +306,7 @@ def test_product_and_app(client: ApigeeClient, request):
products_api = ApiProductsAPI(client=client)
developer_apps_api = DeveloperAppsAPI(client=client)

proxies = [f"identity-service-{environment}"]
proxies = [f"identity-service-mock-{environment}"]

if service_name is not None:
proxies.append(service_name)
Expand Down

0 comments on commit 55992ea

Please sign in to comment.