Initial QSfera import
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"ocs": {
|
||||
"meta": {
|
||||
"status": "ok",
|
||||
"statuscode": 100,
|
||||
"message": "OK"
|
||||
},
|
||||
"data": {
|
||||
"capabilities": {
|
||||
"core": {
|
||||
"pollinterval": 60,
|
||||
"webdav-root": "remote.php/webdav",
|
||||
"status": {
|
||||
"installed": true,
|
||||
"maintenance": false,
|
||||
"needsDbUpgrade": false,
|
||||
"version": "@{version}",
|
||||
"versionstring": "10.11.0",
|
||||
"edition": "Community",
|
||||
"productname": "OpenCloud",
|
||||
"product": "OpenCloud",
|
||||
"productversion": "@{productversion}"
|
||||
},
|
||||
"support-url-signing": true,
|
||||
"support-sse": true
|
||||
},
|
||||
"checksums": {
|
||||
"supportedTypes": [
|
||||
"sha1",
|
||||
"md5",
|
||||
"adler32"
|
||||
],
|
||||
"preferredUploadType": "sha1"
|
||||
},
|
||||
"files": {
|
||||
"privateLinks": true,
|
||||
"bigfilechunking": false,
|
||||
"undelete": true,
|
||||
"versioning": true,
|
||||
"favorites": false,
|
||||
"full_text_search": false,
|
||||
"tags": true,
|
||||
"blacklisted_files": [],
|
||||
"tus_support": {
|
||||
"version": "1.0.0",
|
||||
"resumable": "1.0.0",
|
||||
"extension": "creation,creation-with-upload",
|
||||
"max_chunk_size": 100000000,
|
||||
"http_method_override": ""
|
||||
},
|
||||
"archivers": [
|
||||
{
|
||||
"enabled": true,
|
||||
"version": "2.0.0",
|
||||
"formats": [
|
||||
"tar",
|
||||
"zip"
|
||||
],
|
||||
"archiver_url": "/archiver",
|
||||
"max_num_files": "10000",
|
||||
"max_size": "1073741824"
|
||||
}
|
||||
],
|
||||
"app_providers": [
|
||||
{
|
||||
"enabled": true,
|
||||
"version": "1.1.0",
|
||||
"apps_url": "/app/list",
|
||||
"open_url": "/app/open",
|
||||
"open_web_url": "/app/open-with-web",
|
||||
"new_url": "/app/new"
|
||||
}
|
||||
]
|
||||
},
|
||||
"dav": {
|
||||
"chunking": "",
|
||||
"trashbin": "1.0",
|
||||
"reports": [
|
||||
"search-files"
|
||||
],
|
||||
"chunkingParallelUploadDisabled": false
|
||||
},
|
||||
"files_sharing": {
|
||||
"api_enabled": true,
|
||||
"resharing": true,
|
||||
"group_sharing": true,
|
||||
"sharing_roles": true,
|
||||
"deny_access": false,
|
||||
"auto_accept_share": true,
|
||||
"share_with_group_members_only": true,
|
||||
"share_with_membership_groups_only": true,
|
||||
"search_min_length": 3,
|
||||
"default_permissions": 22,
|
||||
"user_enumeration": {
|
||||
"enabled": true,
|
||||
"group_members_only": true
|
||||
},
|
||||
"federation": {
|
||||
"outgoing": false,
|
||||
"incoming": false
|
||||
},
|
||||
"public": {
|
||||
"enabled": true,
|
||||
"send_mail": true,
|
||||
"social_share": true,
|
||||
"upload": true,
|
||||
"multiple": true,
|
||||
"supports_upload_only": true,
|
||||
"password": {
|
||||
"enforced_for": {
|
||||
"read_only": false,
|
||||
"read_write": false,
|
||||
"read_write_delete": false,
|
||||
"upload_only": false
|
||||
},
|
||||
"enforced": false
|
||||
},
|
||||
"expire_date": {
|
||||
"enabled": false
|
||||
},
|
||||
"can_edit": true,
|
||||
"alias": true
|
||||
},
|
||||
"user": {
|
||||
"send_mail": true,
|
||||
"profile_picture": false,
|
||||
"settings": [
|
||||
{
|
||||
"enabled": true,
|
||||
"version": "1.0.0"
|
||||
}
|
||||
],
|
||||
"expire_date": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"spaces": {
|
||||
"version": "1.0.0",
|
||||
"enabled": true,
|
||||
"projects": true,
|
||||
"share_jail": true,
|
||||
"max_quota": 0
|
||||
},
|
||||
"graph": {
|
||||
"personal-data-export": true,
|
||||
"users": {
|
||||
"read_only_attributes": [
|
||||
"user.onPremisesSamAccountName",
|
||||
"user.displayName",
|
||||
"user.mail",
|
||||
"user.passwordProfile",
|
||||
"user.appRoleAssignments"
|
||||
],
|
||||
"create_disabled": true,
|
||||
"delete_disabled": true,
|
||||
"change_password_self_disabled": true
|
||||
}
|
||||
},
|
||||
"notifications": {
|
||||
"ocs-endpoints": [
|
||||
"list",
|
||||
"get",
|
||||
"delete"
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"major": 10,
|
||||
"minor": 11,
|
||||
"micro": 0,
|
||||
"string": "10.11.0",
|
||||
"edition": "Community",
|
||||
"product": "OpenCloud",
|
||||
"productversion": "4.0.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"installed": true,
|
||||
"maintenance": @{maintenance},
|
||||
"needsDbUpgrade": false,
|
||||
"version": "10.11.0.0",
|
||||
"versionstring": "10.11.0",
|
||||
"edition": "Community",
|
||||
"productname": "OpenCloud",
|
||||
"product": "OpenCloud",
|
||||
"productversion": "4.0.5"
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (C) by Hannah von Reth <hannah.vonreth@owncloud.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
#include "gui/connectionvalidator.h"
|
||||
#include "libsync/abstractnetworkjob.h"
|
||||
#include "libsync/httplogger.h"
|
||||
|
||||
#include "testutils/syncenginetestutils.h"
|
||||
#include "testutils/testutils.h"
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
class TestConnectionValidator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum class FailStage { Invalid, StatusPhp, Capabilities, UserInfo };
|
||||
|
||||
private Q_SLOTS:
|
||||
|
||||
|
||||
void initTestCase() { AbstractNetworkJob::httpTimeout = 50ms; }
|
||||
|
||||
void testStatusPhp_data()
|
||||
{
|
||||
QTest::addColumn<FailStage>("failStage");
|
||||
QTest::addColumn<TestUtils::Values>("values");
|
||||
QTest::addColumn<ConnectionValidator::Status>("status");
|
||||
|
||||
const auto defaultValue = TestUtils::Values{{QStringLiteral("maintenance"), QStringLiteral("false")},
|
||||
{QStringLiteral("version"), QStringLiteral("10.11.0.0")}, {QStringLiteral("productversion"), QStringLiteral("4.0.5")}};
|
||||
|
||||
QTest::newRow("status.php ServiceUnavailable") << FailStage::StatusPhp << defaultValue << ConnectionValidator::StatusNotFound;
|
||||
|
||||
QTest::newRow("user info timeout") << FailStage::UserInfo << defaultValue << ConnectionValidator::Timeout;
|
||||
QTest::newRow("user info 401") << FailStage::UserInfo << defaultValue << ConnectionValidator::CredentialsWrong;
|
||||
QTest::newRow("success") << FailStage::UserInfo << defaultValue << ConnectionValidator::Connected;
|
||||
}
|
||||
|
||||
void testStatusPhp()
|
||||
{
|
||||
QFETCH(FailStage, failStage);
|
||||
QFETCH(TestUtils::Values, values);
|
||||
QFETCH(ConnectionValidator::Status, status);
|
||||
|
||||
auto reachedStage = FailStage::Invalid;
|
||||
FakeFolder fakeFolder({});
|
||||
|
||||
fakeFolder.setServerOverride([&](QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *) -> QNetworkReply * {
|
||||
const auto path = request.url().path();
|
||||
const auto verb = HttpLogger::requestVerb(op, request);
|
||||
if (op == QNetworkAccessManager::GetOperation) {
|
||||
if (path.endsWith(QLatin1String("status.php"))) {
|
||||
reachedStage = FailStage::StatusPhp;
|
||||
if (failStage == FailStage::StatusPhp) {
|
||||
if (status == ConnectionValidator::Timeout) {
|
||||
return new FakeHangingReply(op, request, this);
|
||||
} else if (status == ConnectionValidator::StatusNotFound) {
|
||||
return new FakeErrorReply(op, request, this, 500);
|
||||
}
|
||||
}
|
||||
return new FakePayloadReply(op, request, TestUtils::getPayloadTemplated(QStringLiteral("status.php.json.in"), values), this);
|
||||
} else if (path.endsWith(QLatin1String("capabilities"))) {
|
||||
reachedStage = FailStage::Capabilities;
|
||||
if (failStage == FailStage::Capabilities) {
|
||||
if (status == ConnectionValidator::CredentialsWrong) {
|
||||
return new FakeErrorReply(op, request, this, 401);
|
||||
} else if (status == ConnectionValidator::ServiceUnavailable) {
|
||||
return new FakeErrorReply(op, request, this, 503);
|
||||
} else if (status == ConnectionValidator::Timeout) {
|
||||
return new FakeHangingReply(op, request, this);
|
||||
}
|
||||
}
|
||||
return new FakePayloadReply(op, request, TestUtils::getPayloadTemplated(QStringLiteral("capabilities.json.in"), values), this);
|
||||
} else if (path.endsWith("graph/v1.0/me"_L1)) {
|
||||
reachedStage = FailStage::UserInfo;
|
||||
if (failStage == FailStage::UserInfo) {
|
||||
if (status == ConnectionValidator::CredentialsWrong) {
|
||||
return new FakeErrorReply(op, request, this, 401);
|
||||
} else if (status == ConnectionValidator::Timeout) {
|
||||
return new FakeHangingReply(op, request, this);
|
||||
}
|
||||
}
|
||||
return new FakePayloadReply(op, request, TestUtils::getPayload(QStringLiteral("user.json")), this);
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
});
|
||||
|
||||
ConnectionValidator val(fakeFolder.account());
|
||||
val.checkServer(ConnectionValidator::ValidationMode::ValidateAuthAndUpdate);
|
||||
|
||||
QSignalSpy spy(&val, &ConnectionValidator::connectionResult);
|
||||
QVERIFY(spy.wait());
|
||||
QCOMPARE(spy.first().first().value<ConnectionValidator::Status>(), status);
|
||||
QCOMPARE(reachedStage, failStage);
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(TestConnectionValidator)
|
||||
#include "testconnectionvalidator.moc"
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"ocs": {
|
||||
"meta": {
|
||||
"status": "ok",
|
||||
"statuscode": 200,
|
||||
"message": "OK",
|
||||
"totalitems": "",
|
||||
"itemsperpage": ""
|
||||
},
|
||||
"data": {
|
||||
"id": "test",
|
||||
"display-name": "test",
|
||||
"email": "test@test.com",
|
||||
"language": "en"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user