test: move jwt iat claim test from io tests to spec tests

Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
This commit is contained in:
Taimoor Zaeem
2026-06-25 11:21:28 -05:00
committed by Steve Chavez
parent feb4853273
commit 0bc9fe813f
2 changed files with 7 additions and 23 deletions
+7
View File
@@ -84,6 +84,13 @@ spec withConfig = withConfig baseCfg $ describe "authorization" $ do
request methodGet "/authors_only" [auth] ""
`shouldRespondWith` 200
it "succeeds with a valid iat claim in jwt" $ do
currentTime <- liftIO $ relativeSeconds 0
let jwtPayload = [json|{ "role": "postgrest_test_author", "iat": #{currentTime} }|]
auth = authHeaderJWT $ generateJWT jwtPayload
request methodGet "/authors_only" [auth] ""
`shouldRespondWith` 200
it "fails when auth header is sent empty" $ do
let auth = authHeaderJWT ""
request methodGet "/authors_only" [auth] ""