mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
tests: remove invalid tests
Sending a 1:1 message after a removeContact doesn't create a new invite anymore Change-Id: I0faf4a8134bb5d45672637364bd06fbbe6b20661
This commit is contained in:
@ -146,7 +146,6 @@ private:
|
||||
void testReplayConversation();
|
||||
void testSyncWithoutPinnedCert();
|
||||
void testImportMalformedContacts();
|
||||
void testRemoveReaddMultipleDevice();
|
||||
void testCloneFromMultipleDevice();
|
||||
void testSendReply();
|
||||
void testSearchInConv();
|
||||
@ -199,7 +198,6 @@ private:
|
||||
CPPUNIT_TEST(testReplayConversation);
|
||||
CPPUNIT_TEST(testSyncWithoutPinnedCert);
|
||||
CPPUNIT_TEST(testImportMalformedContacts);
|
||||
CPPUNIT_TEST(testRemoveReaddMultipleDevice);
|
||||
CPPUNIT_TEST(testCloneFromMultipleDevice);
|
||||
CPPUNIT_TEST(testSendReply);
|
||||
CPPUNIT_TEST(testSearchInConv);
|
||||
@ -1965,9 +1963,6 @@ ConversationTest::testReplayConversation()
|
||||
aliceAccount->sendTrustRequest(bobUri, {});
|
||||
// Should retrieve previous conversation
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() {
|
||||
JAMI_ERROR("@@@ {}", bobData.messages.size());
|
||||
if (bobData.messages.size() > 0)
|
||||
JAMI_ERROR("@@@ {}", bobData.messages[0].body["body"]);
|
||||
return bobData.messages.size() == 2 && bobData.messages[0].body["body"] == "foo" && bobData.messages[1].body["body"] == "bar";
|
||||
}));
|
||||
}
|
||||
@ -2050,71 +2045,6 @@ ConversationTest::testImportMalformedContacts()
|
||||
CPPUNIT_ASSERT(contacts[0][libjami::Account::TrustRequest::CONVERSATIONID] == "");
|
||||
}
|
||||
|
||||
void
|
||||
ConversationTest::testRemoveReaddMultipleDevice()
|
||||
{
|
||||
std::cout << "\nRunning test: " << __func__ << std::endl;
|
||||
connectSignals();
|
||||
|
||||
auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId);
|
||||
auto bobAccount = Manager::instance().getAccount<JamiAccount>(bobId);
|
||||
auto bobUri = bobAccount->getUsername();
|
||||
auto aliceUri = aliceAccount->getUsername();
|
||||
|
||||
std::string vcard = "BEGIN:VCARD\n\
|
||||
VERSION:2.1\n\
|
||||
FN:ALICE\n\
|
||||
DESCRIPTION:DESC\n\
|
||||
END:VCARD";
|
||||
auto vCardPath = fileutils::get_data_dir() / aliceId / "profile.vcf";
|
||||
// Add file
|
||||
auto p = std::filesystem::path(vCardPath);
|
||||
dhtnet::fileutils::recursive_mkdir(p.parent_path());
|
||||
std::ofstream file(p);
|
||||
if (file.is_open()) {
|
||||
file << vcard;
|
||||
file.close();
|
||||
}
|
||||
|
||||
// Bob creates a second device
|
||||
auto bobArchive = std::filesystem::current_path().string() + "/bob.gz";
|
||||
std::remove(bobArchive.c_str());
|
||||
bobAccount->exportArchive(bobArchive);
|
||||
std::map<std::string, std::string> details = libjami::getAccountTemplate("RING");
|
||||
details[ConfProperties::TYPE] = "RING";
|
||||
details[ConfProperties::DISPLAYNAME] = "BOB2";
|
||||
details[ConfProperties::ALIAS] = "BOB2";
|
||||
details[ConfProperties::UPNP_ENABLED] = "true";
|
||||
details[ConfProperties::ARCHIVE_PASSWORD] = "";
|
||||
details[ConfProperties::ARCHIVE_PIN] = "";
|
||||
details[ConfProperties::ARCHIVE_PATH] = bobArchive;
|
||||
bob2Id = Manager::instance().addAccount(details);
|
||||
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bob2Data.deviceAnnounced; }));
|
||||
|
||||
// Alice adds bob
|
||||
aliceAccount->addContact(bobUri);
|
||||
aliceAccount->sendTrustRequest(bobUri, {});
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.requestReceived && bob2Data.requestReceived; }));
|
||||
auto aliceMsgSize = aliceData.messages.size();
|
||||
libjami::acceptConversationRequest(bobId, aliceData.conversationId);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() {
|
||||
return !bobData.conversationId.empty() && !bob2Data.conversationId.empty() && aliceMsgSize + 1 == aliceData.messages.size();
|
||||
}));
|
||||
|
||||
// Remove contact
|
||||
bobAccount->removeContact(aliceUri, false);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.removed && bob2Data.removed; }));
|
||||
|
||||
// wait that connections are closed.
|
||||
std::this_thread::sleep_for(5s);
|
||||
|
||||
// Alice send a message
|
||||
bobData.requestReceived = false; bob2Data.requestReceived = false;
|
||||
libjami::sendMessage(aliceId, aliceData.conversationId, "hi"s, "");
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.requestReceived && bob2Data.requestReceived; }));
|
||||
}
|
||||
|
||||
void
|
||||
ConversationTest::testCloneFromMultipleDevice()
|
||||
{
|
||||
|
@ -103,7 +103,6 @@ public:
|
||||
void testBanUnbanMultiDevice();
|
||||
void testBanUnbanGotFirstConv();
|
||||
void testBanHostWhileHosting();
|
||||
void testRemoveContactTwice();
|
||||
void testAddContactTwice();
|
||||
void testBanFromNewDevice();
|
||||
|
||||
@ -156,7 +155,6 @@ private:
|
||||
CPPUNIT_TEST(testBanUnbanMultiDevice);
|
||||
CPPUNIT_TEST(testBanUnbanGotFirstConv);
|
||||
CPPUNIT_TEST(testBanHostWhileHosting);
|
||||
CPPUNIT_TEST(testRemoveContactTwice);
|
||||
CPPUNIT_TEST(testAddContactTwice);
|
||||
CPPUNIT_TEST(testBanFromNewDevice);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
@ -1609,40 +1607,6 @@ ConversationMembersEventTest::testBanHostWhileHosting()
|
||||
CPPUNIT_ASSERT(bobBanned);
|
||||
}
|
||||
|
||||
void
|
||||
ConversationMembersEventTest::testRemoveContactTwice()
|
||||
{
|
||||
connectSignals();
|
||||
|
||||
std::cout << "\nRunning test: " << __func__ << std::endl;
|
||||
|
||||
auto aliceAccount = Manager::instance().getAccount<JamiAccount>(aliceId);
|
||||
auto bobAccount = Manager::instance().getAccount<JamiAccount>(bobId);
|
||||
auto bobUri = bobAccount->getUsername();
|
||||
auto aliceUri = aliceAccount->getUsername();
|
||||
|
||||
aliceAccount->addContact(bobUri);
|
||||
aliceAccount->sendTrustRequest(bobUri, {});
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.requestReceived; }));
|
||||
auto aliceMsgSize = aliceData.messages.size();
|
||||
CPPUNIT_ASSERT(bobAccount->acceptTrustRequest(aliceUri));
|
||||
CPPUNIT_ASSERT(
|
||||
cv.wait_for(lk, 30s, [&]() { return aliceMsgSize + 1 == aliceData.messages.size(); }));
|
||||
// removeContact
|
||||
bobAccount->removeContact(aliceUri, false);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.removed; }));
|
||||
// wait that connections are closed.
|
||||
std::this_thread::sleep_for(10s);
|
||||
// re-add via a new message. Trigger a new request
|
||||
bobData.requestReceived = false;
|
||||
libjami::sendMessage(aliceId, aliceData.conversationId, "foo"s, "");
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.requestReceived; }));
|
||||
// removeContact again (should remove the trust request/conversation)
|
||||
bobData.removed = false;
|
||||
bobAccount->removeContact(aliceUri, false);
|
||||
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&]() { return bobData.removed; }));
|
||||
}
|
||||
|
||||
void
|
||||
ConversationMembersEventTest::testAddContactTwice()
|
||||
{
|
||||
|
Reference in New Issue
Block a user