Tests: Fix permission propagation check
authorChristian Kamm <mail@ckamm.de>
Wed, 13 Feb 2019 10:17:51 +0000 (11:17 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:41 +0000 (10:58 +0100)
It was using the wrong path to the conflict file.

test/testsyncengine.cpp

index b69588ec5df3ceb6852f6ff96919d6f40b07c02a..395a10361dc22c3beaa4a8ac0e4508406a6983db 100644 (file)
@@ -693,14 +693,9 @@ private slots:
         QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a1").permissions(), perm);
         QCOMPARE(QFileInfo(fakeFolder.localPath() + "A/a2").permissions(), perm);
 
-        // Currently the umask applies to conflict files
-        auto octmask = umask(0);
-        umask(octmask);
-        // Qt uses 0x1, 0x2, 0x4 for "other"; 0x10, 0x20, 0x40 for "group" etc
-        auto qtmask = (octmask & 07) + 0x10 * ((octmask & 070) >> 3) + 0x100 * ((octmask & 0700) >> 6);
-        auto maskedPerm = QFileDevice::Permission(perm & (~qtmask));
-        auto conflictName = fakeFolder.syncJournal().conflictRecord("A/a2").path;
-        QCOMPARE(QFileInfo(fakeFolder.localPath() + conflictName).permissions(), maskedPerm);
+        auto conflictName = fakeFolder.syncJournal().conflictRecord(fakeFolder.syncJournal().conflictRecordPaths().first()).path;
+        QVERIFY(conflictName.contains("A/a2"));
+        QCOMPARE(QFileInfo(fakeFolder.localPath() + conflictName).permissions(), perm);
     }
 #endif
 };