Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use aroundAll instead of around with testWithApplication #1694

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec = describe "The JWT combinator" $ do
-- * HasClient {{{

hasClientSpec :: Spec
hasClientSpec = describe "HasClient" $ around (testWithApplication $ return app) $ do
hasClientSpec = describe "HasClient" $ aroundAll (testWithApplication $ return app) $ do

let mkTok :: User -> Maybe UTCTime -> IO Token
mkTok user mexp = do
Expand Down
12 changes: 6 additions & 6 deletions servant-auth/servant-auth-server/test/Servant/Auth/ServerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec = do
authSpec :: Spec
authSpec
= describe "The Auth combinator"
$ around (testWithApplication . return $ app jwtAndCookieApi) $ do
$ aroundAll (testWithApplication . return $ app jwtAndCookieApi) $ do

it "returns a 401 if all authentications are Indefinite" $ \port -> do
get (url port) `shouldHTTPErrorWith` status401
Expand Down Expand Up @@ -172,7 +172,7 @@ cookieAuthSpec :: Spec
cookieAuthSpec
= describe "The Auth combinator" $ do
describe "With XSRF check" $
around (testWithApplication . return $ app cookieOnlyApi) $ do
aroundAll (testWithApplication . return $ app cookieOnlyApi) $ do

it "fails if XSRF header and cookie don't match" $ \port -> property
$ \(user :: User) -> do
Expand Down Expand Up @@ -243,7 +243,7 @@ cookieAuthSpec
describe "With no XSRF check for GET requests" $ let
noXsrfGet xsrfCfg = xsrfCfg { xsrfExcludeGet = True }
cookieCfgNoXsrfGet = cookieCfg { cookieXsrfSetting = fmap noXsrfGet $ cookieXsrfSetting cookieCfg }
in around (testWithApplication . return $ appWithCookie cookieOnlyApi cookieCfgNoXsrfGet) $ do
in aroundAll (testWithApplication . return $ appWithCookie cookieOnlyApi cookieCfgNoXsrfGet) $ do

it "succeeds with no XSRF header or cookie for GET" $ \port -> property
$ \(user :: User) -> do
Expand All @@ -260,7 +260,7 @@ cookieAuthSpec

describe "With no XSRF check at all" $ let
cookieCfgNoXsrf = cookieCfg { cookieXsrfSetting = Nothing }
in around (testWithApplication . return $ appWithCookie cookieOnlyApi cookieCfgNoXsrf) $ do
in aroundAll (testWithApplication . return $ appWithCookie cookieOnlyApi cookieCfgNoXsrf) $ do

it "succeeds with no XSRF header or cookie for GET" $ \port -> property
$ \(user :: User) -> do
Expand Down Expand Up @@ -313,7 +313,7 @@ cookieAuthSpec
jwtAuthSpec :: Spec
jwtAuthSpec
= describe "The JWT combinator"
$ around (testWithApplication . return $ app jwtOnlyApi) $ do
$ aroundAll (testWithApplication . return $ app jwtOnlyApi) $ do

it "fails if 'aud' does not match predicate" $ \port -> property $
\(user :: User) -> do
Expand Down Expand Up @@ -378,7 +378,7 @@ jwtAuthSpec

basicAuthSpec :: Spec
basicAuthSpec = describe "The BasicAuth combinator"
$ around (testWithApplication . return $ app basicAuthApi) $ do
$ aroundAll (testWithApplication . return $ app basicAuthApi) $ do

it "succeeds with the correct password and username" $ \port -> do
resp <- getWith (defaults & auth ?~ basicAuth "ali" "Open sesame") (url port)
Expand Down
Loading