TestKdbx4Format: use MockClock

Otherwise, assertions in TestKdbx4::testCustomData() may fail on rare
occasions, because the customData in a cloned entry won't be identical
to its original, because of its potentially-updated LastModified
property.

Originally noticed in
https://github.com/keepassxreboot/keepassxc/pull/7783#issuecomment-1101404487.
This commit is contained in:
Carlo Teubner authored and Jonathan White committed 2022-04-18 15:09:44 -04:00
1 parent 9bf61bfc5c
commit f15ee90429
2 files changed
+14

No files matched your search

+12
View File
@@ -27,6 +27,7 @@
#include "keys/FileKey.h"
#include "keys/PasswordKey.h"
#include "mock/MockChallengeResponseKey.h"
#include "mock/MockClock.h"
#include <QTest>
int main(int argc, char* argv[])
@@ -113,6 +114,17 @@ void TestKdbx4AesKdf::initTestCaseImpl()
}
Q_DECLARE_METATYPE(QUuid)
void TestKdbx4Format::init()
{
MockClock::setup(new MockClock());
}
void TestKdbx4Format::cleanup()
{
MockClock::teardown();
}
void TestKdbx4Format::testFormat400()
{
QString filename = QString(KEEPASSX_TEST_DATA_DIR).append("/Format400.kdbx");
+2
View File
@@ -56,6 +56,8 @@ class TestKdbx4Format : public QObject
Q_OBJECT
private slots:
void init();
void cleanup();
void testFormat400();
void testFormat400Upgrade();
void testFormat400Upgrade_data();