Files
Oxicloud/tests/api/setup.hurl
T
Edouard Vanbelle 8ab537797a test(api): add API test on contacts
next will be to add CI on it
2026-05-11 00:53:29 +02:00

44 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================
# OxiCloud – First-time admin setup
# =============================================================
# Creates the initial admin account. Only works once: the
# endpoint is disabled after the first admin exists.
#
# Run:
# hurl --variables-file tests/api/hurl.vars --test tests/api/setup.hurl
# =============================================================
# ─────────────────────────────────────────────────────────────
# Step 1 – Create the first admin account
# ─────────────────────────────────────────────────────────────
POST {{base_url}}/api/setup
Content-Type: application/json
{
"username": "{{username}}",
"email": "{{email}}",
"password": "{{password}}"
}
HTTP 201
[Asserts]
jsonpath "$.username" == "{{username}}"
jsonpath "$.email" == "{{email}}"
jsonpath "$.role" == "admin"
# ─────────────────────────────────────────────────────────────
# Step 2 – Verify the endpoint is now disabled (admin exists)
# ─────────────────────────────────────────────────────────────
POST {{base_url}}/api/setup
Content-Type: application/json
{
"username": "another",
"email": "another@example.com",
"password": "irrelevant"
}
HTTP 403
[Asserts]
jsonpath "$.error_type" == "SystemAlreadyInitialized"