|
1 | 1 | import base64 |
| 2 | +import secrets |
2 | 3 |
|
3 | 4 | import pytest |
4 | 5 | import requests |
|
23 | 24 | patch_virtual_server_from_yaml, |
24 | 25 | ) |
25 | 26 |
|
| 27 | +username = "nginx-user-" + secrets.token_hex(4) |
| 28 | +password = secrets.token_hex(8) |
26 | 29 | keycloak_src = f"{TEST_DATA}/oidc/keycloak.yaml" |
27 | 30 | keycloak_vs_src = f"{TEST_DATA}/oidc/virtual-server-idp.yaml" |
28 | 31 | 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 |
71 | 74 | create_user_url = f"https://{ingress_controller_endpoint.public_ip}:{ingress_controller_endpoint.port_ssl}/admin/realms/master/users" |
72 | 75 | headers = {"Content-Type": "application/json", "Authorization": f"Bearer {token}", "Host": keycloak_address} |
73 | 76 | user_payload = { |
74 | | - "username": "nginx-user", |
| 77 | + "username": username, |
75 | 78 | "enabled": True, |
76 | | - "credentials": [{"type": "password", "value": "test", "temporary": False}], |
| 79 | + "credentials": [{"type": "password", "value": password, "temporary": False}], |
77 | 80 | } |
78 | 81 | response = requests.post(create_user_url, headers=headers, json=user_payload, verify=False) |
79 | 82 |
|
@@ -193,9 +196,9 @@ def run_oidc(browser_type, ip_address, port): |
193 | 196 |
|
194 | 197 | page.goto("https://virtual-server-tls.example.com") |
195 | 198 | page.wait_for_selector('input[name="username"]') |
196 | | - page.fill('input[name="username"]', "nginx-user") |
| 199 | + page.fill('input[name="username"]', username) |
197 | 200 | page.wait_for_selector('input[name="password"]', timeout=5000) |
198 | | - page.fill('input[name="password"]', "test") |
| 201 | + page.fill('input[name="password"]', password) |
199 | 202 |
|
200 | 203 | with page.expect_navigation(): |
201 | 204 | page.click('input[type="submit"]') |
|
0 commit comments