Fix cfArgs in tests

This commit is contained in:
IC Rainbow
2024-11-02 13:37:47 +02:00
parent 7fbf37e523
commit 1aa4c59f1a
2 changed files with 5 additions and 5 deletions

View File

@@ -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 <> "}]")

View File

@@ -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")