mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 04:55:48 +03:00
Check local file locked and unlocked correctly in testlocaldiscovery
Signed-off-by: Claudio Cambra <claudio.cambra@gmail.com>
This commit is contained in:
parent
80d0245acb
commit
ff5261eaf1
1 changed files with 25 additions and 9 deletions
|
@ -620,14 +620,16 @@ private slots:
|
||||||
const QString barFileAaaSubFolder("aaa/subfolder/bar");
|
const QString barFileAaaSubFolder("aaa/subfolder/bar");
|
||||||
|
|
||||||
fakeFolder.remoteModifier().insert(fooFileRootFolder);
|
fakeFolder.remoteModifier().insert(fooFileRootFolder);
|
||||||
|
|
||||||
fakeFolder.remoteModifier().insert(barFileRootFolder);
|
fakeFolder.remoteModifier().insert(barFileRootFolder);
|
||||||
fakeFolder.remoteModifier().find("bar")->extraDavProperties = "<nc:lock>1</nc:lock>"
|
|
||||||
"<nc:lock-owner-type>0</nc:lock-owner-type>"
|
const auto lockedFileDavProps = QByteArray("<nc:lock>1</nc:lock>"
|
||||||
"<nc:lock-owner>user1</nc:lock-owner>"
|
"<nc:lock-owner-type>0</nc:lock-owner-type>"
|
||||||
"<nc:lock-owner-displayname>user1</nc:lock-owner-displayname>"
|
"<nc:lock-owner>user1</nc:lock-owner>"
|
||||||
"<nc:lock-owner-editor>user1</nc:lock-owner-editor>"
|
"<nc:lock-owner-displayname>user1</nc:lock-owner-displayname>"
|
||||||
"<nc:lock-time>1648046707</nc:lock-time>";
|
"<nc:lock-owner-editor>user1</nc:lock-owner-editor>"
|
||||||
|
"<nc:lock-time>1648046707</nc:lock-time>");
|
||||||
|
|
||||||
|
fakeFolder.remoteModifier().find("bar")->extraDavProperties = lockedFileDavProps;
|
||||||
|
|
||||||
fakeFolder.remoteModifier().mkdir(QStringLiteral("subfolder"));
|
fakeFolder.remoteModifier().mkdir(QStringLiteral("subfolder"));
|
||||||
fakeFolder.remoteModifier().insert(fooFileSubFolder);
|
fakeFolder.remoteModifier().insert(fooFileSubFolder);
|
||||||
|
@ -637,12 +639,26 @@ private slots:
|
||||||
fakeFolder.remoteModifier().insert(fooFileAaaSubFolder);
|
fakeFolder.remoteModifier().insert(fooFileAaaSubFolder);
|
||||||
fakeFolder.remoteModifier().insert(barFileAaaSubFolder);
|
fakeFolder.remoteModifier().insert(barFileAaaSubFolder);
|
||||||
|
|
||||||
QVERIFY(fakeFolder.syncOnce());
|
ItemCompletedSpy completeSpy(fakeFolder);
|
||||||
|
|
||||||
fakeFolder.remoteModifier().find("bar")->extraDavProperties = "<nc:lock>0</nc:lock>";
|
completeSpy.clear();
|
||||||
|
QVERIFY(fakeFolder.syncOnce());
|
||||||
|
QCOMPARE(completeSpy.findItem("bar")->_locked, OCC::SyncFileItem::LockStatus::LockedItem);
|
||||||
|
SyncJournalFileRecord fileRecordBefore;
|
||||||
|
QVERIFY(fakeFolder.syncJournal().getFileRecord(QStringLiteral("bar"), &fileRecordBefore));
|
||||||
|
QVERIFY(fileRecordBefore._lockstate._locked);
|
||||||
|
|
||||||
|
const auto unlockedFileDavProps = QByteArray("<nc:lock>0</nc:lock>");
|
||||||
|
fakeFolder.remoteModifier().find("bar")->extraDavProperties = unlockedFileDavProps;
|
||||||
|
|
||||||
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem);
|
fakeFolder.syncEngine().setLocalDiscoveryOptions(LocalDiscoveryStyle::DatabaseAndFilesystem);
|
||||||
|
|
||||||
|
completeSpy.clear();
|
||||||
QVERIFY(fakeFolder.syncOnce());
|
QVERIFY(fakeFolder.syncOnce());
|
||||||
|
QCOMPARE(completeSpy.findItem("bar")->_locked, OCC::SyncFileItem::LockStatus::UnlockedItem);
|
||||||
|
SyncJournalFileRecord fileRecordAfter;
|
||||||
|
QVERIFY(fakeFolder.syncJournal().getFileRecord(QStringLiteral("bar"), &fileRecordAfter));
|
||||||
|
QVERIFY(!fileRecordAfter._lockstate._locked);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue