Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>2021-12-09 14:11:23 +0300
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>2022-01-11 11:46:11 +0300
commitc88f57b42d2ba27bdf6c9db3c9b1647f564f06dd (patch)
tree472210cf6574515b7c57be4076c81c62ea8e6729 /test
parent9d7568aa4a140c13733ae358a44201a271897112 (diff)
check modified time sent by upload jobs in automated tests
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Diffstat (limited to 'test')
-rw-r--r--test/syncenginetestutils.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/syncenginetestutils.cpp b/test/syncenginetestutils.cpp
index 53369d020..a5eaaaaf7 100644
--- a/test/syncenginetestutils.cpp
+++ b/test/syncenginetestutils.cpp
@@ -450,8 +450,10 @@ QVector<FileInfo *> FakePutMultiFileReply::performMultiPart(FileInfo &remoteRoot
auto headerParts = oneHeader.split(QStringLiteral(": "));
allHeaders[headerParts.at(0)] = headerParts.at(1);
}
- auto fileName = allHeaders[QStringLiteral("X-File-Path")];
+ const auto fileName = allHeaders[QStringLiteral("X-File-Path")];
+ const auto modtime = allHeaders[QByteArrayLiteral("X-File-Mtime")].toLongLong();
Q_ASSERT(!fileName.isEmpty());
+ Q_ASSERT(modtime > 0);
FileInfo *fileInfo = remoteRootFileInfo.find(fileName);
if (fileInfo) {
fileInfo->size = onePartBody.size();
@@ -480,13 +482,7 @@ void FakePutMultiFileReply::respond()
for(auto fileInfo : qAsConst(_allFileInfo)) {
QJsonObject fileInfoReply;
fileInfoReply.insert("error", QStringLiteral("false"));
- fileInfoReply.insert("OC-OperationStatus", fileInfo->operationStatus);
- fileInfoReply.insert("X-File-Path", fileInfo->path());
- fileInfoReply.insert("OC-ETag", QLatin1String{fileInfo->etag});
- fileInfoReply.insert("ETag", QLatin1String{fileInfo->etag});
fileInfoReply.insert("etag", QLatin1String{fileInfo->etag});
- fileInfoReply.insert("OC-FileID", QLatin1String{fileInfo->fileId});
- fileInfoReply.insert("X-OC-MTime", "accepted"); // Prevents Q_ASSERT(!_runningNow) since we'll call PropagateItemJob::done twice in that case.
emit uploadProgress(fileInfo->size, totalSize);
allFileInfoReply.insert(QChar('/') + fileInfo->path(), fileInfoReply);
}
@@ -977,7 +973,12 @@ QNetworkReply *FakeQNAM::createRequest(QNetworkAccessManager::Operation op, cons
} else if (verb == QLatin1String("GET") || op == QNetworkAccessManager::GetOperation) {
reply = new FakeGetReply { info, op, newRequest, this };
} else if (verb == QLatin1String("PUT") || op == QNetworkAccessManager::PutOperation) {
- reply = new FakePutReply { info, op, newRequest, outgoingData->readAll(), this };
+ if (request.hasRawHeader(QByteArrayLiteral("X-OC-Mtime")) &&
+ request.rawHeader(QByteArrayLiteral("X-OC-Mtime")).toLongLong() <= 0) {
+ reply = new FakeErrorReply { op, request, this, 500 };
+ } else {
+ reply = new FakePutReply { info, op, newRequest, outgoingData->readAll(), this };
+ }
} else if (verb == QLatin1String("MKCOL")) {
reply = new FakeMkcolReply { info, op, newRequest, this };
} else if (verb == QLatin1String("DELETE") || op == QNetworkAccessManager::DeleteOperation) {