mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-11 07:19:44 -05:00
Report database read failure reason in tests
This commit is contained in:
parent
bef7ba2cfe
commit
564188b0d3
@ -65,12 +65,15 @@ void TestKeePass2Writer::initTestCase()
|
||||
buffer.open(QBuffer::ReadWrite);
|
||||
|
||||
KeePass2Writer writer;
|
||||
writer.writeDatabase(&buffer, m_dbOrg);
|
||||
bool writeSuccess = writer.writeDatabase(&buffer, m_dbOrg);
|
||||
QVERIFY(writeSuccess);
|
||||
QVERIFY(!writer.hasError());
|
||||
buffer.seek(0);
|
||||
KeePass2Reader reader;
|
||||
m_dbTest = reader.readDatabase(&buffer, key);
|
||||
QVERIFY(!reader.hasError());
|
||||
if (reader.hasError()) {
|
||||
QFAIL(reader.errorString().toUtf8().constData());
|
||||
}
|
||||
QVERIFY(m_dbTest);
|
||||
}
|
||||
|
||||
|
@ -153,12 +153,19 @@ void TestKeys::testCreateAndOpenFileKey()
|
||||
|
||||
KeePass2Writer writer;
|
||||
writer.writeDatabase(&dbBuffer, dbOrg.data());
|
||||
bool writeSuccess = writer.writeDatabase(&dbBuffer, dbOrg.data());
|
||||
if (writer.hasError()) {
|
||||
QFAIL(writer.errorString().toUtf8().constData());
|
||||
}
|
||||
QVERIFY(writeSuccess);
|
||||
dbBuffer.reset();
|
||||
|
||||
KeePass2Reader reader;
|
||||
QScopedPointer<Database> dbRead(reader.readDatabase(&dbBuffer, compositeKey));
|
||||
if (reader.hasError()) {
|
||||
QFAIL(reader.errorString().toUtf8().constData());
|
||||
}
|
||||
QVERIFY(dbRead);
|
||||
QVERIFY(!reader.hasError());
|
||||
QCOMPARE(dbRead->metadata()->name(), dbName);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user