diff options
author | Christian Kamm <mail@ckamm.de> | 2018-01-23 13:12:45 +0300 |
---|---|---|
committer | Camila San <hello@camila.codes> | 2018-05-15 23:38:35 +0300 |
commit | 17d174e6fad1057505ae635b9d37145802581bf8 (patch) | |
tree | 5f4b0770531ec2e5f0fe0bdf369da7becd834691 /test | |
parent | 5e2270bd570c06905c5be953f7d1eaa055d503ac (diff) |
Conflicts: Add user name to conflict file name #6325
For the case of uploading conflict files only.
Diffstat (limited to 'test')
-rw-r--r-- | test/testsyncconflict.cpp | 9 | ||||
-rw-r--r-- | test/testutility.cpp | 21 |
2 files changed, 30 insertions, 0 deletions
diff --git a/test/testsyncconflict.cpp b/test/testsyncconflict.cpp index daf7eab0d..645bc466d 100644 --- a/test/testsyncconflict.cpp +++ b/test/testsyncconflict.cpp @@ -80,6 +80,12 @@ private slots: fakeFolder.remoteModifier().appendByte("A/a2"); fakeFolder.remoteModifier().appendByte("A/a2"); QVERIFY(fakeFolder.syncOnce()); + + // Verify that the conflict names don't have the user name + for (const auto &name : findConflicts(fakeFolder.currentLocalState().children["A"])) { + QVERIFY(!name.contains(fakeFolder.syncEngine().account()->davUser())); + } + QVERIFY(expectAndWipeConflict(fakeFolder.localModifier(), fakeFolder.currentLocalState(), "A/a1")); QVERIFY(expectAndWipeConflict(fakeFolder.localModifier(), fakeFolder.currentLocalState(), "A/a2")); QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState()); @@ -121,6 +127,9 @@ private slots: QCOMPARE(conflictMap.size(), 2); QCOMPARE(Utility::conflictFileBaseName(conflictMap[a1FileId].toUtf8()), QByteArray("A/a1")); + // Check that the conflict file contains the username + QVERIFY(conflictMap[a1FileId].contains(QString("-%1-").arg(fakeFolder.syncEngine().account()->davUser()))); + QCOMPARE(remote.find(conflictMap[a1FileId])->contentChar, 'L'); QCOMPARE(remote.find("A/a1")->contentChar, 'R'); diff --git a/test/testutility.cpp b/test/testutility.cpp index c83b14199..112efda73 100644 --- a/test/testutility.cpp +++ b/test/testutility.cpp @@ -187,7 +187,28 @@ private slots: qunsetenv("OWNCLOUD_TEST_CASE_PRESERVING"); } + void testSanitizeForFileName_data() + { + QTest::addColumn<QString>("input"); + QTest::addColumn<QString>("output"); + + QTest::newRow("") + << "foobar" + << "foobar"; + QTest::newRow("") + << "a/b?c<d>e\\f:g*h|i\"j" + << "abcdefghij"; + QTest::newRow("") + << QString::fromLatin1("a\x01 b\x1f c\x80 d\x9f") + << "a b c d"; + } + void testSanitizeForFileName() + { + QFETCH(QString, input); + QFETCH(QString, output); + QCOMPARE(sanitizeForFileName(input), output); + } }; QTEST_GUILESS_MAIN(TestUtility) |