Update auth integration test with --user option.

This commit is contained in:
jcamiel 2024-03-26 17:11:50 +01:00
parent 32a73ce7a4
commit 1292ceaa8c
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
6 changed files with 27 additions and 5 deletions

View File

@ -1,3 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl tests_ok/basic_authentication.hurl --user bob@email.com:secret --verbose
hurl --user bob@email.com:secret --verbose tests_ok/basic_authentication.hurl

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_ok/basic_authentication.hurl --user bob@email.com:secret --verbose
hurl --user bob@email.com:secret --verbose tests_ok/basic_authentication.hurl

View File

@ -1,3 +1,5 @@
curl 'http://bob%40email.com:secret@localhost:8000/basic-authentication-per-request'
curl --header 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/basic-authentication-per-request'
curl --header 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/basic-authentication-per-request'
curl --user 'bob@email.com:secret' 'http://localhost:8000/basic-authentication-per-request'
curl --user 'bob@email.com:secret' 'http://localhost:8000/basic-authentication-per-request'

View File

@ -7,13 +7,15 @@ GET http://bob%40email.com:secret@localhost:8000/basic-authentication-per-reques
HTTP 200
`You are authenticated`
# Header value can be computed with `echo -n 'bob@email.com:secret' | base64`
GET http://localhost:8000/basic-authentication-per-request
Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=
HTTP 200
`You are authenticated`
# We can also use a BasicAuth section to specify user and password
# We can also use a `[BasicAuth]` section to specify user and password
# without any base64 encoding.
# Note that spaces surrounded user and password are trimmed. If you
# really want a space in your password (!!), you could use Hurl
@ -23,3 +25,21 @@ GET http://localhost:8000/basic-authentication-per-request
bob@email.com: secret
HTTP 200
`You are authenticated`
# Finally `--user` option can be used per request
GET http://localhost:8000/basic-authentication-per-request
[Options]
user: bob@email.com:secret
HTTP 200
`You are authenticated`
# Variables can also be used with `--user`
GET http://localhost:8000/basic-authentication-per-request
[Options]
variable: user=bob@email.com
variable: password=secret
user: {{user}}:{{password}}
HTTP 200
`You are authenticated`

View File

@ -1,3 +1,3 @@
Set-StrictMode -Version latest
$ErrorActionPreference = 'Stop'
hurl tests_ok/basic_authentication_per_request.hurl --verbose
hurl --verbose tests_ok/basic_authentication_per_request.hurl

View File

@ -1,3 +1,3 @@
#!/bin/bash
set -Eeuo pipefail
hurl tests_ok/basic_authentication_per_request.hurl --verbose
hurl --verbose tests_ok/basic_authentication_per_request.hurl