Files
BanGUI/e2e/resources/auth.resource
2026-05-05 19:51:14 +02:00

32 lines
1.2 KiB
Plaintext

*** Settings ***
Resource ${CURDIR}/common.resource
Library Collections
*** Keywords ***
Login As Admin
# Check setup status.
${response}= GET ${BACKEND_URL}/api/v1/setup
${body}= Set Variable ${response.json()}
IF ${body}[completed] == ${false}
# Complete the setup wizard with the dev master password ("Hallo123!").
${setup_payload}= Create Dictionary
... master_password=Hallo123!
... database_path=bangui.db
... fail2ban_socket=/var/run/fail2ban/fail2ban.sock
... timezone=UTC
... session_duration_minutes=60
POST ${BACKEND_URL}/api/v1/setup json=${setup_payload}
# Retry login after setup.
${response}= POST ${BACKEND_URL}/api/v1/auth/login
END
# Perform login.
${login_payload}= Create Dictionary password=Hallo123!
${response}= POST ${BACKEND_URL}/api/v1/auth/login json=${login_payload}
# Store session cookie for subsequent requests.
${session_cookie}= Get Cookie bangui_session
Set Suite Variable ${session_cookie} ${session_cookie}
Log Logged in as admin.