test(integration): reorganize Hurl integration tests
This commit is contained in:
parent
368ff80ef3
commit
15020e9878
18 changed files with 154 additions and 10 deletions
|
|
@ -0,0 +1,32 @@
|
|||
signing_key = "tmp/secrets/signing.key"
|
||||
|
||||
[instance]
|
||||
base_uri = "http://localhost:8086"
|
||||
name = "Example org"
|
||||
logo_uri = "https://example.org/logo.png"
|
||||
|
||||
[[applications]]
|
||||
slug = "demo_app"
|
||||
name = "Demo app"
|
||||
description = "A super application where you can do everything you want."
|
||||
client_id = "00000001-0000-0000-0000-000000000001"
|
||||
client_secret = "dummy_client_secret"
|
||||
login_uri = "https://localhost:9876"
|
||||
allowed_redirect_uris = [
|
||||
"http://localhost:9090/callback",
|
||||
"http://localhost:9876/callback"
|
||||
]
|
||||
visibility = "Internal"
|
||||
authorize_flow = "Implicit"
|
||||
|
||||
[[roles]]
|
||||
slug = "basic"
|
||||
name = "Basic"
|
||||
description = "Basic user"
|
||||
default = true
|
||||
|
||||
[[roles]]
|
||||
slug = "admin"
|
||||
name = "Administrator"
|
||||
description = "Full power on organization instance"
|
||||
|
||||
11
tests/hurl_integration/scenarios/authorizations_management/init_db.sh
Executable file
11
tests/hurl_integration/scenarios/authorizations_management/init_db.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
password_hash="$(echo -n "root" | argon2 salt_06cGGWYDJCZ -e)"
|
||||
echo $password_hash
|
||||
SQL=$(cat <<EOF
|
||||
INSERT INTO users
|
||||
(id, handle, email, roles, status, password_hash, created_at)
|
||||
VALUES
|
||||
('$(uuid)', 'root', 'root@example.org', '[]', 'Active', '$password_hash', '2024-11-30T00:00:00Z');
|
||||
EOF)
|
||||
echo $SQL | sqlite3 $DB_PATH
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
# Login into account
|
||||
POST {{ base_url }}/login
|
||||
[FormParams]
|
||||
login: root
|
||||
password: root
|
||||
HTTP 303
|
||||
[Captures]
|
||||
user_jwt: cookie "minauthator_jwt"
|
||||
[Asserts]
|
||||
cookie "minauthator_jwt" exists
|
||||
cookie "minauthator_jwt[Value]" contains "eyJ0"
|
||||
cookie "minauthator_jwt[SameSite]" == "Lax"
|
||||
|
||||
# Assert that we have currently no authorizations
|
||||
GET {{ base_url }}/me/authorizations
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
xpath "string(///h1)" == "Your authorizations"
|
||||
xpath "string(///i)" == "You didn't authorized or accessed any applications for now."
|
||||
|
||||
# OAuth2 implicit flow (pre-granted app)
|
||||
GET {{ base_url }}/authorize
|
||||
[QueryStringParams]
|
||||
client_id: 00000001-0000-0000-0000-000000000001
|
||||
response_type: code
|
||||
redirect_uri: http://localhost:9090/callback
|
||||
state: Afk4kf6pbZkms78jM
|
||||
scope: user_read_basic
|
||||
HTTP 302
|
||||
[Captures]
|
||||
authorization_code: header "Location" regex "\\?code=(.*)&"
|
||||
|
||||
# OAuth2 get access token
|
||||
POST {{ base_url }}/api/token
|
||||
[BasicAuth]
|
||||
00000001-0000-0000-0000-000000000001: dummy_client_secret
|
||||
[FormParams]
|
||||
code: {{ authorization_code }}
|
||||
scope: user_read_basic
|
||||
redirect_uri: http://localhost:9090/callback
|
||||
grant_type: authorization_code
|
||||
HTTP 200
|
||||
[Captures]
|
||||
access_token: jsonpath "$.access_token"
|
||||
|
||||
# Asserts that the new authorization is listed
|
||||
GET {{ base_url }}/me/authorizations
|
||||
HTTP 200
|
||||
[Asserts]
|
||||
xpath "string(///h1)" == "Your authorizations"
|
||||
xpath "string(///main/ul/li)" contains "UserReadBasic"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue