fix, tests

This commit is contained in:
spaced4ndy
2024-04-05 11:34:41 +04:00
parent 2b6b8f8a62
commit 5f0cbca2ba
4 changed files with 15 additions and 36 deletions

View File

@@ -860,7 +860,7 @@ processChatCommand' vr = \case
throwChatError (CECommandError $ "reaction already " <> if add then "added" else "removed")
when (add && length rs >= maxMsgReactions) $
throwChatError (CECommandError "too many reactions")
APIForwardChatItem fromChatRef (ChatRef toCType toChatId) itemId -> withUser $ \user -> withChatLock "forwardChatItem" $ case toCType of
APIForwardChatItem fromChatRef (ChatRef toCType toChatId) itemId -> withUser $ \user -> case toCType of
CTDirect -> withContactLock "sendMessage" toChatId $ do
cm <- prepareForward user
sendContactContentMessage user toChatId False Nothing cm True

View File

@@ -617,20 +617,8 @@ testXFTPWithRelativePaths =
withXFTPServer $ do
-- agent is passed xftp work directory only on chat start,
-- so for test we work around by stopping and starting chat
alice ##> "/_stop"
alice <## "chat stopped"
alice #$> ("/_files_folder ./tests/fixtures", id, "ok")
alice #$> ("/_temp_folder ./tests/tmp/alice_xftp", id, "ok")
alice ##> "/_start"
alice <## "chat started"
bob ##> "/_stop"
bob <## "chat stopped"
bob #$> ("/_files_folder ./tests/tmp/bob_files", id, "ok")
bob #$> ("/_temp_folder ./tests/tmp/bob_xftp", id, "ok")
bob ##> "/_start"
bob <## "chat started"
setRelativePaths alice "./tests/fixtures" "./tests/tmp/alice_xftp"
setRelativePaths bob "./tests/tmp/bob_files" "./tests/tmp/bob_xftp"
connectUsers alice bob
alice #> "/f @bob test.pdf"

View File

@@ -279,27 +279,9 @@ testForwardFileRelativePaths :: HasCallStack => FilePath -> IO ()
testForwardFileRelativePaths =
testChat3 aliceProfile bobProfile cathProfile $
\alice bob cath -> withXFTPServer $ do
alice ##> "/_stop"
alice <## "chat stopped"
alice #$> ("/_files_folder ./tests/fixtures", id, "ok")
alice #$> ("/_temp_folder ./tests/tmp/alice_xftp", id, "ok")
alice ##> "/_start"
alice <## "chat started"
bob ##> "/_stop"
bob <## "chat stopped"
bob #$> ("/_files_folder ./tests/tmp/bob_files", id, "ok")
bob #$> ("/_temp_folder ./tests/tmp/bob_xftp", id, "ok")
bob ##> "/_start"
bob <## "chat started"
cath ##> "/_stop"
cath <## "chat stopped"
cath #$> ("/_files_folder ./tests/tmp/cath_files", id, "ok")
cath #$> ("/_temp_folder ./tests/tmp/cath_xftp", id, "ok")
cath ##> "/_start"
cath <## "chat started"
setRelativePaths alice "./tests/fixtures" "./tests/tmp/alice_xftp"
setRelativePaths bob "./tests/tmp/bob_files" "./tests/tmp/bob_xftp"
setRelativePaths cath "./tests/tmp/cath_files" "./tests/tmp/cath_xftp"
connectUsers alice bob
connectUsers bob cath

View File

@@ -723,3 +723,12 @@ linkAnotherSchema link
xftpCLI :: [String] -> IO [String]
xftpCLI params = lines <$> capture_ (withArgs params xftpClientCLI)
setRelativePaths :: HasCallStack => TestCC -> String -> String -> IO ()
setRelativePaths cc filesFolder tempFolder = do
cc ##> "/_stop"
cc <## "chat stopped"
cc #$> ("/_files_folder " <> filesFolder, id, "ok")
cc #$> ("/_temp_folder " <> tempFolder, id, "ok")
cc ##> "/_start"
cc <## "chat started"