Skip to content

Commit bc671a3

Browse files
committed
test challenge api ttl
1 parent 6f29906 commit bc671a3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

integration/test/Test/DomainVerification.hs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import API.Brig
77
import API.BrigInternal
88
import API.Common
99
import API.GalleyInternal (setTeamFeatureLockStatus, setTeamFeatureStatus)
10+
import Control.Concurrent (threadDelay)
1011
import SetupHelpers
1112
import Test.DNSMock
1213
import Testlib.Prelude
@@ -386,6 +387,20 @@ testOverwriteOwnershipToken = do
386387
(mkDomainRedirectBackend "https://wire1.example.com")
387388
>>= assertStatus 401
388389

390+
testChallengeTtl :: (HasCallStack) => App ()
391+
testChallengeTtl = withModifiedBackend
392+
(def {brigCfg = (setField "optSettings.setChallengeTTL" (2 :: Int))})
393+
$ \domain -> do
394+
registrationDomain <- randomDomain
395+
challenge <- getDomainVerificationChallenge domain registrationDomain >>= getJSON 200
396+
challengeId <- challenge %. "id" & asString
397+
challengeToken <- challenge %. "token" & asString
398+
399+
-- wait until the challenge ttl expires
400+
liftIO $ threadDelay 2_500_000
401+
bindResponse (verifyDomain domain registrationDomain challengeId challengeToken) $ \resp -> do
402+
resp.status `shouldMatchInt` 404
403+
389404
-- helpers
390405

391406
data ChallengeSetup = ChallengeSetup

0 commit comments

Comments
 (0)