From 2cd49b2820e2934f3cb6835dda96d6c6b0227e1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois-Simon=20Fauteux-Chapleau?=
 <francois-simon.fauteux-chapleau@savoirfairelinux.com>
Date: Wed, 30 Apr 2025 15:50:21 -0400
Subject: [PATCH] unitTest: fix fileTransfer

testAskToMultipleParticipants was failing because of a temporary file
that was generated by the previous test and not deleted at the end.

GitLab: #1126
Change-Id: I5a98d259ba974fe72ced94ca3ccecb611a60dc2a
---
 test/unitTest/fileTransfer/fileTransfer.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/unitTest/fileTransfer/fileTransfer.cpp b/test/unitTest/fileTransfer/fileTransfer.cpp
index 50d5fcc66..c50ab2ca9 100644
--- a/test/unitTest/fileTransfer/fileTransfer.cpp
+++ b/test/unitTest/fileTransfer/fileTransfer.cpp
@@ -155,9 +155,11 @@ FileTransferTest::setUp()
 void
 FileTransferTest::tearDown()
 {
-    std::filesystem::remove(sendPath);
-    std::filesystem::remove(recvPath);
-    std::filesystem::remove(recv2Path);
+    for (auto path : {sendPath, recvPath, recv2Path}) {
+        std::filesystem::remove(path);
+        path += ".tmp";
+        std::filesystem::remove(path);
+    }
     wait_for_removal_of({aliceId, bobId, carlaId});
 }
 
@@ -446,8 +448,6 @@ FileTransferTest::testBadSha3sumIn()
     // The file transfer will be sent but refused by bob
     CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return aliceData.code == static_cast<int>(libjami::DataTransferEventCode::finished); }));
     CPPUNIT_ASSERT(!cv.wait_for(lk, 30s, [&]() { return bobData.code == static_cast<int>(libjami::DataTransferEventCode::finished); }));
-
-    std::filesystem::remove(sendPath);
 }
 
 void
-- 
GitLab