Skip to content

Commit 7b751a2

Browse files
authored
Merge pull request #778 from NHSDigital/make-basic-auth-optional
Make providing a basic auth username/password or token optional
2 parents f3fa526 + a963c5c commit 7b751a2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.env.generic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
PROGRAMMES_ENABLED=FLU,HPV,MENACWY,MMR,TD_IPV
22
BASE_URL=https://qa.mavistesting.com
33

4+
# if running tests against an environment behind basic auth (e.g. qa)
45
# provide either a token or a username/password pair
56
BASIC_AUTH_USERNAME=
67
BASIC_AUTH_PASSWORD=

mavis/test/fixtures/playwright.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ def browser_context_args(
4040
**browser_context_args,
4141
"extra_http_headers": {"Authorization": f"Basic {basic_auth_token}"},
4242
}
43+
if basic_auth_credentials["username"] and basic_auth_credentials["password"]:
44+
return {**browser_context_args, "http_credentials": basic_auth_credentials}
4345

44-
return {**browser_context_args, "http_credentials": basic_auth_credentials}
46+
return browser_context_args

0 commit comments

Comments
 (0)