Skip to content

Commit

Permalink
test not-found and verify response body
Browse files Browse the repository at this point in the history
  • Loading branch information
battermann committed Dec 9, 2024
1 parent b1bb438 commit 6d32c35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions integration/test/API/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ randomEmail = do
u <- randomName
pure $ u <> "@example.com"

randomDomain :: App String
randomDomain = do
u <- randomName
pure $ (fmap toLower u) <> ".com"

randomExternalId :: App String
randomExternalId = liftIO $ do
-- external ID has no constraints, but we only generate human-readable samples
Expand Down
8 changes: 7 additions & 1 deletion integration/test/Test/EnterpriseLogin.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
module Test.EnterpriseLogin where

import API.BrigInternal
import API.Common
import Testlib.Prelude

testDomainRegistrationLock :: App ()
testDomainRegistrationLock = do
let domain = "example.com"
domain <- randomDomain
bindResponse (getDomainRegistration OwnDomain domain) $ \resp -> do
resp.status `shouldMatchInt` 404
bindResponse (domainRegistrationLock OwnDomain domain) $ \resp -> do
resp.status `shouldMatchInt` 200
bindResponse (getDomainRegistration OwnDomain domain) $ \resp -> do
resp.status `shouldMatchInt` 200
resp.json %. "domain" `shouldMatch` domain
resp.json %. "domain_redirect" `shouldMatch` "locked"
resp.json %. "team_invite" `shouldMatch` "allowed"

0 comments on commit 6d32c35

Please sign in to comment.