diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-01-20 16:38:21 +0300 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2017-01-20 16:48:53 +0300 |
commit | 8a70d22af778c84dc3aece2a1e698b9da3ef5fea (patch) | |
tree | 5e0bd372d59a39bdffefa730b42a04a61e825ad4 /test/syncenginetestutils.h | |
parent | a63d970e5ef39b6de3f55a75a4cabb8b4bbd18dc (diff) |
ChunkingNG: Add some tests
- Test that we recover correctly if the chunks were removed on the server.
- Test changing the file localy while uploading.
Diffstat (limited to 'test/syncenginetestutils.h')
-rw-r--r-- | test/syncenginetestutils.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/syncenginetestutils.h b/test/syncenginetestutils.h index f33096352..a4a12884f 100644 --- a/test/syncenginetestutils.h +++ b/test/syncenginetestutils.h @@ -315,7 +315,10 @@ public: QString fileName = getFilePathFromUrl(request.url()); Q_ASSERT(!fileName.isNull()); // for root, it should be empty const FileInfo *fileInfo = remoteRootFileInfo.find(fileName); - Q_ASSERT(fileInfo); + if (!fileInfo) { + QMetaObject::invokeMethod(this, "respond404", Qt::QueuedConnection); + return; + } QString prefix = request.url().path().left(request.url().path().size() - fileName.size()); // Don't care about the request and just return a full propfind @@ -375,6 +378,13 @@ public: emit finished(); } + Q_INVOKABLE void respond404() { + setAttribute(QNetworkRequest::HttpStatusCodeAttribute, 404); + setError(InternalServerError, "Not Found"); + emit metaDataChanged(); + emit finished(); + } + void abort() override { } qint64 bytesAvailable() const override { return payload.size() + QIODevice::bytesAvailable(); } |