From d88160218b7c19b719b62ac9eb97328cbadecd81 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 5 Apr 2025 00:33:16 +0200 Subject: [PATCH] Fix tests --- .github/workflows/{auth.yml => auth-hurl.yml} | 2 +- auth/tests/basic.hurl | 6 +++--- auth/tests/invalid-password.hurl | 14 ++++++++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) rename .github/workflows/{auth.yml => auth-hurl.yml} (94%) diff --git a/.github/workflows/auth.yml b/.github/workflows/auth-hurl.yml similarity index 94% rename from .github/workflows/auth.yml rename to .github/workflows/auth-hurl.yml index 9d06b5e2..d5f47917 100644 --- a/.github/workflows/auth.yml +++ b/.github/workflows/auth-hurl.yml @@ -49,7 +49,7 @@ jobs: run: | ./keibi > logs & wget --retry-connrefused --retry-on-http-error=502 http://localhost:4568/health - hurl --variable host=http://localhost:4568 tests/* + hurl --error-format long --variable host=http://localhost:4568 tests/* env: POSTGRES_SERVER: localhost diff --git a/auth/tests/basic.hurl b/auth/tests/basic.hurl index df70fa68..a3488fe1 100644 --- a/auth/tests/basic.hurl +++ b/auth/tests/basic.hurl @@ -6,13 +6,13 @@ POST {{host}}/sessions } HTTP 404 -# Invalid password +# Invalid username POST {{host}}/sessions { - "login": "invalid-password-user", + "login": "invalid-username-user", "password": "pass" } -HTTP 403 +HTTP 404 # Me cant be accessed without an account GET {{host}}/users/me diff --git a/auth/tests/invalid-password.hurl b/auth/tests/invalid-password.hurl index 7c51f14b..7817a09a 100644 --- a/auth/tests/invalid-password.hurl +++ b/auth/tests/invalid-password.hurl @@ -27,14 +27,15 @@ DELETE {{host}}/sessions/current Authorization: Bearer {{jwt}} HTTP 200 -POST {{hosts}}/sessions +# Ensure we can login again & /users/me is the same +POST {{host}}/sessions { "login": "login-user", "password": "password-login-user" } HTTP 201 [Captures] -jwt: jsonpath "$.token" +token: jsonpath "$.token" GET {{host}}/jwt Authorization: Bearer {{token}} @@ -49,6 +50,15 @@ HTTP 200 jsonpath "$.username" == "login-user" body == {{register_info}} + +# Invalid password login +POST {{host}}/sessions +{ + "login": "login-user", + "password": "pass-invalid" +} +HTTP 403 + DELETE {{host}}/users/me Authorization: Bearer {{jwt}} HTTP 200