@@ -79,6 +79,12 @@ def asid(is_mocked_environment):
7979 )
8080
8181
82+ @pytest .fixture (scope = "session" )
83+ def apim_app_flow_vars (allowListodsCode = None ):
84+ if allowListodsCode is not None :
85+ return {"ers" : {"allowListodsCode" : allowListodsCode }}
86+
87+
8288@pytest .fixture (scope = "session" )
8389def referring_clinician (is_mocked_environment ):
8490 return Actor .RC_DEV if is_mocked_environment else Actor .RC
@@ -127,7 +133,8 @@ async def user_restricted_product(client, make_product):
127133 [
128134 "urn:nhsd:apim:user-nhs-id:aal3:e-referrals-service-api" ,
129135 "urn:nhsd:apim:user-nhs-id:aal2:e-referrals-service-api" ,
130- ]
136+ ],
137+ additional_attributes = [{"name" : "EUOAllowlist" , "value" : "false" }],
131138 )
132139
133140 print (f"product created: { productName } " )
@@ -240,7 +247,7 @@ def _update_function(attr, value):
240247
241248@pytest .fixture
242249def make_product (client , environment , service_name ):
243- async def _make_product (product_scopes ):
250+ async def _make_product (product_scopes , additional_attributes = None ):
244251 product = ApiProductsAPI (client = client )
245252
246253 proxies = [f"identity-service-mock-{ environment } " ]
@@ -251,9 +258,12 @@ async def _make_product(product_scopes):
251258 product_name = f"apim-auto-{ uuid4 ()} "
252259 attributes = [
253260 {"name" : "access" , "value" : "public" },
254- {"name" : "EUOAllowlistRequired" , "value" : "false" },
255261 {"name" : "ratelimit" , "value" : "10ps" },
256262 ]
263+
264+ if additional_attributes is not None :
265+ attributes .extend (additional_attributes )
266+
257267 body = {
258268 "proxies" : proxies ,
259269 "scopes" : product_scopes ,
@@ -273,9 +283,17 @@ async def _make_product(product_scopes):
273283
274284
275285@pytest_asyncio .fixture
276- async def user_restricted_app (client , make_app , user_restricted_product , asid ):
286+ async def user_restricted_app (
287+ client , make_app , user_restricted_product , asid , apim_app_flow_vars
288+ ):
277289 # Setup
278- app = await make_app (user_restricted_product , {"asid" : asid })
290+ if apim_app_flow_vars is not None :
291+ app = await make_app (
292+ user_restricted_product ,
293+ {"asid" : asid , "apim-app-flow-vars" : apim_app_flow_vars },
294+ )
295+ else :
296+ app = await make_app (user_restricted_product , {"asid" : asid })
279297
280298 appName = app ["name" ]
281299 print (f"App created: { appName } " )
@@ -318,7 +336,7 @@ async def _make_app(product, custom_attributes={}):
318336
319337@pytest .fixture
320338def authenticate_user (client , user_restricted_app , environment , oauth_url ):
321- async def _auth (actor : Actor ):
339+ async def _auth (actor : Actor , apim_app_flow_vars = None ):
322340 print (f"Attempting to authenticate: { actor } " )
323341
324342 credentials = user_restricted_app ["credentials" ][0 ]
0 commit comments