зеркало из https://github.com/nextcloud/desktop.git
fix automated tests missing toString() convert from QVariant
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Родитель
274d866c19
Коммит
670b2ce42f
|
@ -237,7 +237,7 @@ QNetworkReply *ShareTestHelper::qnamOverride(QNetworkAccessManager::Operation op
|
|||
|
||||
// Properly formatted PROPFIND URL goes something like:
|
||||
// https://cloud.nextcloud.com/remote.php/dav/files/claudio/Readme.md
|
||||
if(reqPath.endsWith(testFileName) && req.attribute(QNetworkRequest::CustomVerbAttribute) == "PROPFIND") {
|
||||
if(reqPath.endsWith(testFileName) && req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "PROPFIND") {
|
||||
|
||||
reply = new FakePropfindReply(fakeFolder.remoteModifier(), op, req, this);
|
||||
|
||||
|
@ -247,13 +247,13 @@ QNetworkReply *ShareTestHelper::qnamOverride(QNetworkAccessManager::Operation op
|
|||
if (op == QNetworkAccessManager::PostOperation) {
|
||||
reply = handleSharePostOperation(op, req, device);
|
||||
|
||||
} else if(req.attribute(QNetworkRequest::CustomVerbAttribute) == "DELETE") {
|
||||
} else if(req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "DELETE") {
|
||||
reply = handleShareDeleteOperation(op, req, reqPath);
|
||||
|
||||
} else if(op == QNetworkAccessManager::PutOperation) {
|
||||
reply = handleSharePutOperation(op, req, reqPath, device);
|
||||
|
||||
} else if(req.attribute(QNetworkRequest::CustomVerbAttribute) == "GET") {
|
||||
} else if(req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "GET") {
|
||||
reply = handleShareGetOperation(op, req, reqPath);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1364,7 +1364,7 @@ FakeFileLockReply::FakeFileLockReply(FileInfo &remoteRootFileInfo,
|
|||
QObject *parent)
|
||||
: FakePropfindReply(remoteRootFileInfo, op, request, parent)
|
||||
{
|
||||
const auto verb = request.attribute(QNetworkRequest::CustomVerbAttribute);
|
||||
const auto verb = request.attribute(QNetworkRequest::CustomVerbAttribute).toString();
|
||||
|
||||
setRequest(request);
|
||||
setUrl(request.url());
|
||||
|
|
|
@ -216,7 +216,7 @@ private slots:
|
|||
|
||||
int fingerprintRequests = 0;
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation, const QNetworkRequest &request, QIODevice *stream) -> QNetworkReply * {
|
||||
auto verb = request.attribute(QNetworkRequest::CustomVerbAttribute);
|
||||
auto verb = request.attribute(QNetworkRequest::CustomVerbAttribute).toString();
|
||||
if (verb == "PROPFIND") {
|
||||
auto data = stream->readAll();
|
||||
if (data.contains("data-fingerprint")) {
|
||||
|
|
|
@ -93,7 +93,7 @@ private slots:
|
|||
return FakePutReply::perform(fakeFolder.remoteModifier(), request, putPayload);
|
||||
};
|
||||
return new FakeAsyncReply("/async-poll/" + file.toUtf8(), op, request, &fakeFolder.syncEngine());
|
||||
} else if (request.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") {
|
||||
} else if (request.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE") {
|
||||
QString file = getFilePathFromUrl(QUrl::fromEncoded(request.rawHeader("Destination")));
|
||||
Q_ASSERT(testCases.contains(file));
|
||||
auto &testCase = testCases[file];
|
||||
|
@ -214,7 +214,7 @@ private slots:
|
|||
nGET++;
|
||||
} else if (op == QNetworkAccessManager::DeleteOperation) {
|
||||
nDELETE++;
|
||||
} else if (request.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") {
|
||||
} else if (request.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE") {
|
||||
nMOVE++;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -234,7 +234,7 @@ private slots:
|
|||
sawPut = true;
|
||||
} else if (op == QNetworkAccessManager::DeleteOperation) {
|
||||
sawDelete = true;
|
||||
} else if (request.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") {
|
||||
} else if (request.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE") {
|
||||
sawMove = true;
|
||||
}
|
||||
return nullptr;
|
||||
|
@ -303,7 +303,7 @@ private slots:
|
|||
int nGET = 0;
|
||||
int responseDelay = 100000; // bigger than abort-wait timeout
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *) -> QNetworkReply * {
|
||||
if (request.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") {
|
||||
if (request.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE") {
|
||||
QTimer::singleShot(50, &parent, [&]() { fakeFolder.syncEngine().abort(); });
|
||||
moveChecksumHeader = request.rawHeader("OC-Checksum");
|
||||
return new DelayedReply<FakeChunkMoveReply>(responseDelay, fakeFolder.uploadState(), fakeFolder.remoteModifier(), op, request, &parent);
|
||||
|
@ -385,7 +385,7 @@ private slots:
|
|||
QObject parent;
|
||||
int responseDelay = 200; // smaller than abort-wait timeout
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *) -> QNetworkReply * {
|
||||
if (request.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") {
|
||||
if (request.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE") {
|
||||
QTimer::singleShot(50, &parent, [&]() { fakeFolder.syncEngine().abort(); });
|
||||
return new DelayedReply<FakeChunkMoveReply>(responseDelay, fakeFolder.uploadState(), fakeFolder.remoteModifier(), op, request, &parent);
|
||||
}
|
||||
|
@ -592,7 +592,7 @@ private slots:
|
|||
if (!chunking && op == QNetworkAccessManager::PutOperation) {
|
||||
checksumHeader = request.rawHeader("OC-Checksum");
|
||||
return new DelayedReply<FakePutReply>(responseDelay, fakeFolder.remoteModifier(), op, request, outgoingData->readAll(), &fakeFolder.syncEngine());
|
||||
} else if (chunking && request.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE") {
|
||||
} else if (chunking && request.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE") {
|
||||
checksumHeader = request.rawHeader("OC-Checksum");
|
||||
return new DelayedReply<FakeChunkMoveReply>(responseDelay, fakeFolder.uploadState(), fakeFolder.remoteModifier(), op, request, &fakeFolder.syncEngine());
|
||||
} else if (op == QNetworkAccessManager::GetOperation) {
|
||||
|
|
|
@ -95,7 +95,7 @@ private slots:
|
|||
QString fatalErrorPrefix = "Server replied with an error while reading directory \"B\" : ";
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *)
|
||||
-> QNetworkReply *{
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute) == "PROPFIND" && req.url().path().endsWith(errorFolder)) {
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "PROPFIND" && req.url().path().endsWith(errorFolder)) {
|
||||
if (errorKind == InvalidXML) {
|
||||
return new FakeBrokenXmlPropfindReply(fakeFolder.remoteModifier(), op, req, this);
|
||||
} else if (errorKind == Timeout) {
|
||||
|
@ -154,7 +154,7 @@ private slots:
|
|||
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *)
|
||||
-> QNetworkReply *{
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute) == "PROPFIND" && req.url().path().endsWith("nopermissions"))
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "PROPFIND" && req.url().path().endsWith("nopermissions"))
|
||||
return new MissingPermissionsPropfindReply(fakeFolder.remoteModifier(), op, req, this);
|
||||
return nullptr;
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ private slots:
|
|||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation, const QNetworkRequest &req, QIODevice *device)
|
||||
-> QNetworkReply * {
|
||||
// Record what path we are querying for the size
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute) == "PROPFIND") {
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "PROPFIND") {
|
||||
if (device->readAll().contains("<size "))
|
||||
sizeRequests << req.url().path();
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@ private slots:
|
|||
|
||||
if(req.url().toString().startsWith(_accountState->account()->url().toString()) &&
|
||||
reqPath == QStringLiteral("ocs/v2.php/apps/files_sharing/api/v1/sharees") &&
|
||||
req.attribute(QNetworkRequest::CustomVerbAttribute) == "GET") {
|
||||
req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "GET") {
|
||||
|
||||
const auto urlQuery = QUrlQuery(req.url());
|
||||
const auto searchParam = urlQuery.queryItemValue(QStringLiteral("search"));
|
||||
|
|
|
@ -29,7 +29,7 @@ struct OperationCounter {
|
|||
++nPUT;
|
||||
if (op == QNetworkAccessManager::DeleteOperation)
|
||||
++nDELETE;
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute) == "MOVE")
|
||||
if (req.attribute(QNetworkRequest::CustomVerbAttribute).toString() == "MOVE")
|
||||
++nMOVE;
|
||||
return nullptr;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче