Skip to content

Commit 53848d6

Browse files
[RAA-7705]-[]-[api service pipeline test fix]-[DW]
1 parent 281ccfd commit 53848d6

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

tests/conftest.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,26 @@ async def user_restricted_product(client, make_product):
147147
product.delete_product_by_name(product_name=productName)
148148

149149

150+
@pytest_asyncio.fixture
151+
async def user_restricted_product_ods_validation(client, make_product):
152+
# Setup
153+
productName = await make_product(
154+
[
155+
"urn:nhsd:apim:user-nhs-id:aal3:e-referrals-service-api",
156+
"urn:nhsd:apim:user-nhs-id:aal2:e-referrals-service-api",
157+
],
158+
additional_attributes=[{"name": "EUOAllowlistRequired", "value": "true"}],
159+
)
160+
161+
print(f"product created: {productName}")
162+
yield productName
163+
164+
# Teardown
165+
print(f"Cleanup product: {productName}")
166+
product = ApiProductsAPI(client=client)
167+
product.delete_product_by_name(product_name=productName)
168+
169+
150170
@pytest.fixture
151171
def update_user_restricted_product(
152172
user_restricted_product, client: ApigeeClient
@@ -307,6 +327,27 @@ async def user_restricted_app(
307327
app.delete_app_by_name(email="apm-testing-internal-dev@nhs.net", app_name=appName)
308328

309329

330+
@pytest_asyncio.fixture
331+
async def user_restricted_app_ods_validation(
332+
client, make_app, user_restricted_product_ods_validation, asid, apim_app_flow_vars
333+
):
334+
# Setup
335+
odslist = json.dumps({"ers": {"allowListodsCode": apim_app_flow_vars}})
336+
app = await make_app(
337+
user_restricted_product_ods_validation,
338+
{"asid": asid, "apim-app-flow-vars": odslist},
339+
)
340+
341+
appName = app["name"]
342+
print(f"App created: {appName}")
343+
yield app
344+
345+
# Teardown
346+
print(f"Cleanup app: {appName}")
347+
app = DeveloperAppsAPI(client=client)
348+
app.delete_app_by_name(email="apm-testing-internal-dev@nhs.net", app_name=appName)
349+
350+
310351
@pytest.fixture
311352
def make_app(client):
312353
async def _make_app(product, custom_attributes={}):

tests/integration/test_user_restricted.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ async def test_user_restricted_valid_ods_code(
8686
async def test_user_restricted_invalid_ods_code(
8787
self,
8888
authenticate_user,
89+
user_restricted_app_ods_validation,
8990
service_url,
9091
user: Actor,
9192
asid,
@@ -155,6 +156,7 @@ async def test_user_restricted_invalid_ods_code(
155156
async def test_user_restricted_missing_ods_header(
156157
self,
157158
authenticate_user,
159+
user_restricted_app_ods_validation,
158160
service_url,
159161
user: Actor,
160162
asid,
@@ -225,6 +227,7 @@ async def test_user_restricted_missing_ods_header(
225227
async def test_user_restricted_missing_ods_code(
226228
self,
227229
authenticate_user,
230+
user_restricted_app_ods_validation,
228231
service_url,
229232
user: Actor,
230233
asid,

0 commit comments

Comments
 (0)