Skip to content

Commit

Permalink
Fix unit test now that we really abort the sync
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing committed Nov 23, 2023
1 parent 2b95e9f commit 5a7afb7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/testchunkingng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,25 @@ private slots:
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *) -> QNetworkReply * {
if (request.attribute(QNetworkRequest::CustomVerbAttribute).toByteArray() == "MOVE") {
QTimer::singleShot(50ms, &parent, [&]() { fakeFolder.syncEngine().abort(); });
// while the response is delayed, the move is performed in the custructor, so immideatly
return new DelayedReply<FakeChunkMoveReply>(responseDelay, fakeFolder.uploadState(), fakeFolder.remoteModifier(), op, request, &parent);
}
return nullptr;
});

// Test 1: NEW file aborted
fakeFolder.localModifier().insert(QStringLiteral("A/a0"), size);
QVERIFY(!fakeFolder.applyLocalModificationsAndSync());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());

QVERIFY(fakeFolder.applyLocalModificationsAndSync());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());

// Test 2: modified file upload aborted
fakeFolder.localModifier().appendByte(QStringLiteral("A/a0"));
QVERIFY(!fakeFolder.applyLocalModificationsAndSync());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());

QVERIFY(fakeFolder.applyLocalModificationsAndSync());
QCOMPARE(fakeFolder.currentLocalState(), fakeFolder.currentRemoteState());
}
Expand Down

0 comments on commit 5a7afb7

Please sign in to comment.