Remove obsolete read only state from database. (#7324)

This commit is contained in:
Patrick Klein 2022-01-29 03:26:53 +01:00 committed by GitHub
parent c914c116e4
commit bce8c84c26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 28 additions and 120 deletions

View file

@ -144,11 +144,7 @@ void TestDatabase::testEmptyRecycleBinOnDisabled()
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("123"));
auto db = QSharedPointer<Database>::create();
QVERIFY(db->open(filename, key, nullptr, false));
// Explicitly mark DB as read-write in case it was opened from a read-only drive.
// Prevents assertion failures on CI systems when the data dir is not writable
db->setReadOnly(false);
QVERIFY(db->open(filename, key, nullptr));
QSignalSpy spyModified(db.data(), SIGNAL(modified()));
@ -163,8 +159,7 @@ void TestDatabase::testEmptyRecycleBinOnNotCreated()
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("123"));
auto db = QSharedPointer<Database>::create();
QVERIFY(db->open(filename, key, nullptr, false));
db->setReadOnly(false);
QVERIFY(db->open(filename, key, nullptr));
QSignalSpy spyModified(db.data(), SIGNAL(modified()));
@ -179,8 +174,7 @@ void TestDatabase::testEmptyRecycleBinOnEmpty()
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("123"));
auto db = QSharedPointer<Database>::create();
QVERIFY(db->open(filename, key, nullptr, false));
db->setReadOnly(false);
QVERIFY(db->open(filename, key, nullptr));
QSignalSpy spyModified(db.data(), SIGNAL(modified()));
@ -195,8 +189,7 @@ void TestDatabase::testEmptyRecycleBinWithHierarchicalData()
auto key = QSharedPointer<CompositeKey>::create();
key->addKey(QSharedPointer<PasswordKey>::create("123"));
auto db = QSharedPointer<Database>::create();
QVERIFY(db->open(filename, key, nullptr, false));
db->setReadOnly(false);
QVERIFY(db->open(filename, key, nullptr));
QFile originalFile(filename);
qint64 initialSize = originalFile.size();