diff --git a/test/Feature/AuthSpec.hs b/test/Feature/AuthSpec.hs index b2228faa4..4c5f208a0 100644 --- a/test/Feature/AuthSpec.hs +++ b/test/Feature/AuthSpec.hs @@ -11,15 +11,21 @@ import SpecHelper -- }}} spec :: Spec -spec = around withApp $ describe "authorization" $ do - it "hides tables that anonymous does not own" $ - get "/authors_only" `shouldRespondWith` 404 - it "indicates login failure" $ do - let auth = authHeader "postgrest_test_author" "fakefake" - request methodGet "/authors_only" [auth] "" - `shouldRespondWith` 401 - it "allows users with permissions to see their tables" $ do - _ <- post "/postgrest/users" [json| { "id":"jdoe", "pass": "1234", "role": "postgrest_test_author" } |] - let auth = authHeader "jdoe" "1234" - request methodGet "/authors_only" [auth] "" - `shouldRespondWith` 200 +spec = beforeAll + (clearTable "postgrest.auth") . afterAll_ (clearTable "postgrest.auth") + $ around withApp + $ describe "authorization" $ do + + it "hides tables that anonymous does not own" $ + get "/authors_only" `shouldRespondWith` 404 + + it "indicates login failure" $ do + let auth = authHeader "postgrest_test_author" "fakefake" + request methodGet "/authors_only" [auth] "" + `shouldRespondWith` 401 + + it "allows users with permissions to see their tables" $ do + _ <- post "/postgrest/users" [json| { "id":"jdoe", "pass": "1234", "role": "postgrest_test_author" } |] + let auth = authHeader "jdoe" "1234" + request methodGet "/authors_only" [auth] "" + `shouldRespondWith` 200 diff --git a/test/Feature/InsertSpec.hs b/test/Feature/InsertSpec.hs index 3e75e8657..2aaf3f856 100644 --- a/test/Feature/InsertSpec.hs +++ b/test/Feature/InsertSpec.hs @@ -19,7 +19,7 @@ import TestTypes(IncPK(..), CompoundPK(..)) --import Debug.Trace spec :: Spec -spec = around withApp $ do +spec = afterAll_ resetDb $ around withApp $ do describe "Posting new record" $ do after_ (clearTable "menagerie") . it "accepts disparate json types" $ do p <- post "/menagerie"