From 91dfd47f1d157bd1ffc6026a69b24edd11a90bb2 Mon Sep 17 00:00:00 2001 From: Diogo Biazus Date: Thu, 22 Oct 2015 23:20:16 -0400 Subject: [PATCH] Adds another test case for jwt with empty claims --- test/Feature/AuthSpec.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/Feature/AuthSpec.hs b/test/Feature/AuthSpec.hs index b02d9a334..992ca1d9e 100644 --- a/test/Feature/AuthSpec.hs +++ b/test/Feature/AuthSpec.hs @@ -36,6 +36,11 @@ spec = beforeAll request methodGet "/authors_only" [auth] "" `shouldRespondWith` 404 + it "hides tables from users with JWT that contain no claims about role" $ do + let auth = authHeaderJWT "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.MKYc_lOECtB0LJOiykilAdlHodB-I0_id2qHKq35dmc" + request methodGet "/authors_only" [auth] "" + `shouldRespondWith` 404 + it "recovers after 400 error with logged in user" $ do _ <- post "/authors_only" [json| { "owner": "jdoe", "secret": "test content" } |] let auth = authHeaderJWT "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoicG9zdGdyZXN0X3Rlc3RfYXV0aG9yIiwiaWQiOiJqZG9lIn0.y4vZuu1dDdwAl0-S00MCRWRYMlJ5YAMSir6Es6WtWx0"