core: auto accept via address and incognito mode specified (#1233)

* core: Auto accept via address and incognito mode specified

* Fix test

* Refactoring

* No forcing

* Apply suggestions from code review

* refactor

* refactor AutoAccept

* Test

* Test

* allow different test output order

* rename

* rename

Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com>
Co-authored-by: JRoberts <8711996+jr-simplex@users.noreply.github.com>
This commit is contained in:
Stanislav Dmitrenko
2022-10-21 19:14:12 +03:00
committed by GitHub
parent 5bcb725ea5
commit 1470b8d128
10 changed files with 108 additions and 51 deletions

View File

@@ -100,6 +100,7 @@ chatTests = do
it "reject contact and delete contact link" testRejectContactAndDeleteUserContact
it "delete connection requests when contact link deleted" testDeleteConnectionRequests
it "auto-reply message" testAutoReplyMessage
it "auto-reply message in incognito" testAutoReplyMessageInIncognito
describe "incognito mode" $ do
it "connect incognito via invitation link" testConnectIncognitoInvitationLink
it "connect incognito via contact address" testConnectIncognitoContactAddress
@@ -2314,7 +2315,7 @@ testAutoReplyMessage = testChat2 aliceProfile bobProfile $
\alice bob -> do
alice ##> "/ad"
cLink <- getContactLink alice True
alice ##> "/auto_accept on text hello!"
alice ##> "/auto_accept on incognito=off text hello!"
alice <## "auto_accept on"
alice <## "auto reply:"
alice <## "hello!"
@@ -2331,6 +2332,32 @@ testAutoReplyMessage = testChat2 aliceProfile bobProfile $
alice <# "@bob hello!"
]
testAutoReplyMessageInIncognito :: IO ()
testAutoReplyMessageInIncognito = testChat2 aliceProfile bobProfile $
\alice bob -> do
alice ##> "/ad"
cLink <- getContactLink alice True
alice ##> "/auto_accept on incognito=on text hello!"
alice <## "auto_accept on, incognito"
alice <## "auto reply:"
alice <## "hello!"
bob ##> ("/c " <> cLink)
bob <## "connection request sent!"
alice <## "bob (Bob): accepting contact request..."
aliceIncognito <- getTermLine alice
concurrentlyN_
[ do
bob <## (aliceIncognito <> ": contact is connected")
bob <# (aliceIncognito <> "> hello!"),
do
alice <## ("bob (Bob): contact is connected, your incognito profile for this contact is " <> aliceIncognito)
alice
<### [ "use /info bob to print out this incognito profile again",
WithTime "i @bob hello!"
]
]
testConnectIncognitoInvitationLink :: IO ()
testConnectIncognitoInvitationLink = testChat3 aliceProfile bobProfile cathProfile $
\alice bob cath -> do