Skip to content

Commit

Permalink
Amending product to try to fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
helen-brown committed Oct 2, 2023
1 parent 3484752 commit 6063d55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 1 addition & 3 deletions tests/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ def test_correlation_id_mirrored_in_resp_when_error(service_url):
assert resp.headers["x-correlation-id"] == correlation_id, resp.headers


# TODO Fix
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -286,7 +285,6 @@ def test_token_exchange_happy_path(immunisation_history_app: Dict, service_url:
assert len(body["entry"]) == 3, body


# TODO Fix
@pytest.mark.e2e
@pytest.mark.parametrize(
"immunisation_history_app",
Expand Down Expand Up @@ -329,7 +327,7 @@ def test_token_exchange_sad_path(immunisation_history_app: Dict, environment: st
"test_product_and_app",
[
{
"scopes": ["urn:nhsd:apim:user-nhs-id:aal3:immunisation-history"],
"scopes": ["urn:nhsd:apim:user-nhs-id:aal3:immunisation-history", "urn:nhsd:apim:app:level3:immunisation-history"],
"requested_proofing_level": "P9",
"identity_proofing_level": "P9",
},
Expand Down
12 changes: 5 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _create_app(dev_apps_api: DeveloperAppsAPI, app_name: str, api_products: Lis
def _create_product(product_name: str, products_api: ApiProductsAPI, proxies: List, scopes: List):
attributes = [
{"name": "access", "value": "public"},
{"name": "ratelimit", "value": "10ps"}
{"name": "ratelimit", "value": "300pm"}
]
body = {
"approvalType": "auto",
Expand All @@ -184,11 +184,12 @@ def _create_product(product_name: str, products_api: ApiProductsAPI, proxies: Li
"environments": ["internal-dev"],
"name": product_name,
"proxies": proxies,
"quota": 500,
"quota": 300,
"quotaInterval": "1",
"quotaTimeUnit": "minute",
"scopes": scopes
}

product = products_api.post_products(body=body)
return product

Expand Down Expand Up @@ -264,7 +265,7 @@ def test_product_and_app(client: ApigeeClient, service_name: str, environment: s
products_api = ApiProductsAPI(client=client)
developer_apps_api = DeveloperAppsAPI(client=client)

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

if service_name is not None:
proxies.append(service_name)
Expand All @@ -281,10 +282,7 @@ def test_product_and_app(client: ApigeeClient, service_name: str, environment: s
]
}

api_products = get_product_names("-application-restricted")
api_products.append(product_name)

app = _create_app(dev_apps_api=developer_apps_api, app_name=app_name, api_products=api_products,
app = _create_app(dev_apps_api=developer_apps_api, app_name=app_name, api_products=[product_name],
app_attrs=custom_attributes, jwt_public_key_url=jwt_public_key_url)
app["request_params"] = request_params
yield product, app
Expand Down
3 changes: 3 additions & 0 deletions tests/feature_tests/utils/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def get_nhs_login_id_token(nhs_number: str, proofing_level: str):
)


# This method from pytest-nhsd-apim has changed in later versions of the library so will need updating if these tests are required
# however given the PR for this https://github.com/NHSDigital/immunisation-history-api/pull/157/files states that they did not run
# at the time of the commit, it is not being updated with the library update.
@logging(teaser="Getting OAuth token")
def get_oauth_token(base_url: str, app_key: str, app_jwt_private_key: str, id_token: str = None) -> str:
token = get_access_token_via_signed_jwt_flow(
Expand Down

0 comments on commit 6063d55

Please sign in to comment.