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 2022-04-18 18:40:10 +01:00 committed by Jonathan White
parent 9bf61bfc5c
commit f15ee90429
2 changed files with 14 additions and 0 deletions

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

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();