Skip to content
Snippets Groups Projects
Commit 1ada7f7b authored by Sébastien Blin's avatar Sébastien Blin
Browse files

misc: fix ut_migration, ut_revoke, ut_namedirectory

Change-Id: I98e2318c9774cc00af77d3f4bbc1d5149c13edc3
parent 6addbbc1
Branches
No related tags found
No related merge requests found
......@@ -62,7 +62,7 @@ struct AccountArchive
AccountArchive() = default;
AccountArchive(const std::vector<uint8_t>& data, const std::vector<uint8_t>& password_salt = {}) { deserialize(data, password_salt); }
AccountArchive(const std::filesystem::path& path, std::string_view scheme, const std::string& pwd) { load(path, scheme, pwd); }
AccountArchive(const std::filesystem::path& path, std::string_view scheme = {}, const std::string& pwd = {}) { load(path, scheme, pwd); }
/** Serialize structured archive data to memory. */
std::string serialize() const;
......
......@@ -345,7 +345,7 @@ public:
* @return if the archive was exported
*/
bool exportArchive(const std::string& destinationPath, std::string_view scheme = {}, const std::string& password = {});
bool revokeDevice(const std::string& device, std::string_view scheme, const std::string& password = {});
bool revokeDevice(const std::string& device, std::string_view scheme = {}, const std::string& password = {});
std::map<std::string, std::string> getKnownDevices() const;
bool isPasswordValid(const std::string& password);
......
......@@ -106,14 +106,14 @@ MigrationTest::testLoadExpiredAccount()
// Get alice's expiration
auto archivePath = fileutils::get_data_dir() / aliceAccount->getAccountID() / "archive.gz";
auto devicePath = fileutils::get_data_dir() / aliceAccount->getAccountID() / "ring_device.crt";
auto archive = AccountArchive(archivePath, "");
auto archive = AccountArchive(archivePath);
auto deviceCert = dht::crypto::Certificate(fileutils::loadFile(devicePath));
auto deviceExpiration = deviceCert.getExpiration();
auto accountExpiration = archive.id.second->getExpiration();
// Update validity
CPPUNIT_ASSERT(aliceAccount->setValidity("", "", {}, 9));
archive = AccountArchive(archivePath, "");
archive = AccountArchive(archivePath);
deviceCert = dht::crypto::Certificate(fileutils::loadFile(devicePath));
auto newDeviceExpiration = deviceCert.getExpiration();
auto newAccountExpiration = archive.id.second->getExpiration();
......@@ -144,7 +144,7 @@ MigrationTest::testLoadExpiredAccount()
aliceAccount->forceReloadAccount();
CPPUNIT_ASSERT(cv.wait_for(lk, 15s, [&]() { return aliceMigrated; }));
archive = AccountArchive(archivePath, "");
archive = AccountArchive(archivePath);
deviceCert = dht::crypto::Certificate(fileutils::loadFile(devicePath));
deviceExpiration = deviceCert.getExpiration();
accountExpiration = archive.id.second->getExpiration();
......@@ -213,7 +213,7 @@ MigrationTest::testMigrationAfterRevokation()
// Revoke bob2
auto bob2Device = std::string(bob2Account->currentDeviceId());
bobAccount->revokeDevice("", bob2Device);
bobAccount->revokeDevice(bob2Device);
CPPUNIT_ASSERT(cv.wait_for(lk, 10s, [&]() { return deviceRevoked; }));
// Note: bob2 will need some seconds to get the revokation list
std::this_thread::sleep_for(10s);
......
......@@ -196,7 +196,7 @@ NameDirectoryTest::testRegisterName()
cv.notify_one();
}));
libjami::registerSignalHandlers(confHandlers);
CPPUNIT_ASSERT(libjami::registerName(aliceId, "", "password", "foo"));
CPPUNIT_ASSERT(libjami::registerName(aliceId, "foo"));
CPPUNIT_ASSERT(cv.wait_for(lk, 30s, [&] { return nameRegistered; }));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment