mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-26 01:02:24 +00:00
Fix cfArgs in tests
This commit is contained in:
@@ -620,7 +620,7 @@ testXFTPFileTransferEncrypted =
|
||||
createDirectoryIfMissing True "./tests/tmp/alice/"
|
||||
createDirectoryIfMissing True "./tests/tmp/bob/"
|
||||
WFResult cfArgs <- chatWriteFile (chatController alice) srcPath src
|
||||
let fileJSON = LB.unpack $ J.encode $ CryptoFile srcPath $ Just cfArgs
|
||||
let fileJSON = LB.unpack $ J.encode $ CryptoFile srcPath cfArgs
|
||||
withXFTPServer $ do
|
||||
connectUsers alice bob
|
||||
alice ##> ("/_send @2 json [{\"msgContent\":{\"type\":\"file\", \"text\":\"\"}, \"fileSource\": " <> fileJSON <> "}]")
|
||||
|
||||
@@ -282,8 +282,8 @@ testFileCApi fileName tmp = do
|
||||
ptr <- mallocBytes $ B.length src
|
||||
putByteString ptr src
|
||||
r <- peekCAString =<< cChatWriteFile cc cPath ptr cLen
|
||||
Just (WFResult cfArgs@(CFArgs key nonce)) <- jDecode r
|
||||
let encryptedFile = CryptoFile path $ Just cfArgs
|
||||
Just (WFResult cfArgs@(Just (CFArgs key nonce))) <- jDecode r
|
||||
let encryptedFile = CryptoFile path cfArgs
|
||||
CF.getFileContentsSize encryptedFile `shouldReturn` fromIntegral (B.length src)
|
||||
cKey <- encodedCString key
|
||||
cNonce <- encodedCString nonce
|
||||
@@ -318,8 +318,8 @@ testFileEncryptionCApi fileName tmp = do
|
||||
let toPath = tmp </> (fileName <> ".encrypted.pdf")
|
||||
cToPath <- newCString toPath
|
||||
r <- peekCAString =<< cChatEncryptFile cc cFromPath cToPath
|
||||
Just (WFResult cfArgs@(CFArgs key nonce)) <- jDecode r
|
||||
CF.getFileContentsSize (CryptoFile toPath $ Just cfArgs) `shouldReturn` fromIntegral (B.length src)
|
||||
Just (WFResult cfArgs@(Just (CFArgs key nonce))) <- jDecode r
|
||||
CF.getFileContentsSize (CryptoFile toPath cfArgs) `shouldReturn` fromIntegral (B.length src)
|
||||
cKey <- encodedCString key
|
||||
cNonce <- encodedCString nonce
|
||||
let toPath' = tmp </> (fileName <> ".decrypted.pdf")
|
||||
|
||||
Reference in New Issue
Block a user