Skip to content

Commit 1f2a515

Browse files
committed
use random creds
1 parent fb360f0 commit 1f2a515

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/suite/test_oidc.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import base64
2+
import secrets
23

34
import pytest
45
import requests
@@ -23,6 +24,8 @@
2324
patch_virtual_server_from_yaml,
2425
)
2526

27+
username = "nginx-user-" + secrets.token_hex(4)
28+
password = secrets.token_hex(8)
2629
keycloak_src = f"{TEST_DATA}/oidc/keycloak.yaml"
2730
keycloak_vs_src = f"{TEST_DATA}/oidc/virtual-server-idp.yaml"
2831
oidc_secret_src = f"{TEST_DATA}/oidc/client-secret.yaml"
@@ -71,9 +74,9 @@ def keycloak_setup(request, kube_apis, test_namespace, ingress_controller_endpoi
7174
create_user_url = f"https://{ingress_controller_endpoint.public_ip}:{ingress_controller_endpoint.port_ssl}/admin/realms/master/users"
7275
headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}", "Host": keycloak_address}
7376
user_payload = {
74-
"username": "nginx-user",
77+
"username": username,
7578
"enabled": True,
76-
"credentials": [{"type": "password", "value": "test", "temporary": False}],
79+
"credentials": [{"type": "password", "value": password, "temporary": False}],
7780
}
7881
response = requests.post(create_user_url, headers=headers, json=user_payload, verify=False)
7982

@@ -193,9 +196,9 @@ def run_oidc(browser_type, ip_address, port):
193196

194197
page.goto("https://virtual-server-tls.example.com")
195198
page.wait_for_selector('input[name="username"]')
196-
page.fill('input[name="username"]', "nginx-user")
199+
page.fill('input[name="username"]', username)
197200
page.wait_for_selector('input[name="password"]', timeout=5000)
198-
page.fill('input[name="password"]', "test")
201+
page.fill('input[name="password"]', password)
199202

200203
with page.expect_navigation():
201204
page.click('input[type="submit"]')

0 commit comments

Comments
 (0)