Skip to content

Commit b8f75fb

Browse files
committed
add test
1 parent ebf200c commit b8f75fb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

integration/test/Test/MLS.hs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,32 @@ testPastStaleApplicationMessage otherDomain = do
9292
-- bob's application messages are now rejected
9393
void $ postMLSMessage bob1 msg2.message >>= getJSON 409
9494

95+
testEpochZeroApplicationMessage :: (HasCallStack) => App ()
96+
testEpochZeroApplicationMessage = do
97+
[alice] <- createAndConnectUsers [make OwnDomain]
98+
alice1 <- createMLSClient def alice
99+
conv <- createNewGroup def alice1
100+
void $ createAddCommit alice1 conv [] >>= sendAndConsumeCommitBundle
101+
mlsConv <- getMLSConv conv
102+
103+
-- send message, make sure that's succeeding
104+
msg <- createApplicationMessage mlsConv.convId alice1 "group is initialised"
105+
postMLSMessage alice1 msg.message >>= assertStatus 201
106+
107+
-- reset conversation
108+
conv' <- resetMLSConversation alice1 conv
109+
convId' <- objConvId conv'
110+
mlsConv' <- getMLSConv convId'
111+
keys <- getMLSPublicKeys alice1.qualifiedUserId >>= getJSON 200
112+
resetClientGroup mlsConv'.ciphersuite alice1 mlsConv'.groupId convId' keys
113+
114+
-- send message, make sure that's failing
115+
msg' <- createApplicationMessage convId' alice1 "group not initialised"
116+
postMLSMessage alice1 msg'.message >>= flip withResponse \resp -> do
117+
j <- getJSON 400 resp
118+
j %. "label" `shouldMatch` "mls-protocol-error"
119+
j %. "message" `shouldMatch` "Application messages at epoch 0 are not supported"
120+
95121
testFutureStaleApplicationMessage :: (HasCallStack) => App ()
96122
testFutureStaleApplicationMessage = do
97123
[alice, bob, charlie] <- createAndConnectUsers [OwnDomain, OwnDomain, OwnDomain]

0 commit comments

Comments
 (0)