diff options
author | Hannah von Reth <hannah.vonreth@owncloud.com> | 2021-01-08 17:31:18 +0300 |
---|---|---|
committer | Matthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr> | 2021-05-06 10:35:59 +0300 |
commit | 17a1a630a4ec9afeac492a47ec08e7271b418261 (patch) | |
tree | a830279e5c2e3428ad3cc77e9156d6e6cde28700 /test | |
parent | bff386e5c12fb1368b4287a222603063af1777ee (diff) |
Use the http logger with the unittests
This allow better debugging of the tests
Signed-off-by: Matthieu Gallien <matthieu_gallien@yahoo.fr>
Diffstat (limited to 'test')
-rw-r--r-- | test/syncenginetestutils.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/test/syncenginetestutils.cpp b/test/syncenginetestutils.cpp index 88d276e49..7d5fbe760 100644 --- a/test/syncenginetestutils.cpp +++ b/test/syncenginetestutils.cpp @@ -6,6 +6,8 @@ */ #include "syncenginetestutils.h" +#include "httplogger.h" +#include "accessmanager.h" #include <memory> @@ -803,27 +805,30 @@ QNetworkReply *FakeQNAM::createRequest(QNetworkAccessManager::Operation op, cons bool isUpload = request.url().path().startsWith(sUploadUrl.path()); FileInfo &info = isUpload ? _uploadFileInfo : _remoteRootFileInfo; + auto newRequest = request; + newRequest.setRawHeader("X-Request-ID", OCC::AccessManager::generateRequestId()); auto verb = request.attribute(QNetworkRequest::CustomVerbAttribute); FakeReply *reply = nullptr; if (verb == QLatin1String("PROPFIND")) // Ignore outgoingData always returning somethign good enough, works for now. - reply = new FakePropfindReply { info, op, request, this }; + reply = new FakePropfindReply { info, op, newRequest, this }; else if (verb == QLatin1String("GET") || op == QNetworkAccessManager::GetOperation) - reply = new FakeGetReply { info, op, request, this }; + reply = new FakeGetReply { info, op, newRequest, this }; else if (verb == QLatin1String("PUT") || op == QNetworkAccessManager::PutOperation) - reply = new FakePutReply { info, op, request, outgoingData->readAll(), this }; + reply = new FakePutReply { info, op, newRequest, outgoingData->readAll(), this }; else if (verb == QLatin1String("MKCOL")) - reply = new FakeMkcolReply { info, op, request, this }; + reply = new FakeMkcolReply { info, op, newRequest, this }; else if (verb == QLatin1String("DELETE") || op == QNetworkAccessManager::DeleteOperation) - reply = new FakeDeleteReply { info, op, request, this }; + reply = new FakeDeleteReply { info, op, newRequest, this }; else if (verb == QLatin1String("MOVE") && !isUpload) - reply = new FakeMoveReply { info, op, request, this }; + reply = new FakeMoveReply { info, op, newRequest, this }; else if (verb == QLatin1String("MOVE") && isUpload) - reply = new FakeChunkMoveReply { info, _remoteRootFileInfo, op, request, this }; + reply = new FakeChunkMoveReply { info, _remoteRootFileInfo, op, newRequest, this }; else { qDebug() << verb << outgoingData; Q_UNREACHABLE(); } + OCC::HttpLogger::logRequest(reply, op, outgoingData); return reply; } |