test: fix keycloak execute-actions-email probe
This commit is contained in:
parent
eb11eaff4e
commit
7cbbb7e193
@ -100,7 +100,7 @@ def main() -> int:
|
||||
if not users:
|
||||
create_payload = {
|
||||
"username": probe_username,
|
||||
"enabled": False,
|
||||
"enabled": True,
|
||||
"email": probe_email,
|
||||
"emailVerified": True,
|
||||
}
|
||||
@ -130,6 +130,14 @@ def main() -> int:
|
||||
if not isinstance(user_id, str) or not user_id:
|
||||
raise SystemExit("probe user missing id")
|
||||
|
||||
# execute-actions-email requires the user to be enabled.
|
||||
status, user = _request_json("GET", f"{admin_users_url}/{urllib.parse.quote(user_id)}", access_token, timeout_s=30)
|
||||
if status == 200 and isinstance(user, dict) and user.get("enabled") is False:
|
||||
user["enabled"] = True
|
||||
status, body = _request_json("PUT", f"{admin_users_url}/{urllib.parse.quote(user_id)}", access_token, user, timeout_s=30)
|
||||
if status not in (200, 204):
|
||||
raise SystemExit(f"unexpected status enabling probe user: {status} body={body}")
|
||||
|
||||
# Trigger an email to validate Keycloak SMTP integration.
|
||||
query = urllib.parse.urlencode(
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: keycloak-portal-e2e-execute-actions-email-2
|
||||
name: keycloak-portal-e2e-execute-actions-email-3
|
||||
namespace: sso
|
||||
spec:
|
||||
backoffLimit: 3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user