Skip to content

Commit

Permalink
Merge pull request #1694 from intolerable/intolerable/withTestApplica…
Browse files Browse the repository at this point in the history
…tion-aroundAll

use `aroundAll` instead of `around` with `testWithApplication`
  • Loading branch information
ysangkok committed Jul 11, 2023
2 parents 16cfd03 + 872acad commit 104a8ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
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

0 comments on commit 104a8ad

Please sign in to comment.