aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-09-17 16:33:27 +0200
committernpmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>2019-09-28 09:39:28 +0000
commitde6940352a2f708376219a89ec84a8e6d25ca59e (patch)
tree459bacfc183b24d611be1877fbe22bbcd4efb1d6 /tests/lib
parentc8cd607681ac128228f57114ce14dd67ab05de04 (diff)
downloadnextcloud-server-de6940352a2f708376219a89ec84a8e6d25ca59e.tar.gz
nextcloud-server-de6940352a2f708376219a89ec84a8e6d25ca59e.zip
Move settings to an app
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at> Signed-off-by: npmbuildbot[bot] <npmbuildbot[bot]@users.noreply.github.com>
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/App/AppManagerTest.php5
-rw-r--r--tests/lib/AppFramework/AppTest.php2
-rw-r--r--tests/lib/AppTest.php9
-rw-r--r--tests/lib/InfoXmlTest.php1
-rw-r--r--tests/lib/L10N/FactoryTest.php4
-rw-r--r--tests/lib/Settings/Admin/MailTest.php134
-rw-r--r--tests/lib/Settings/Admin/SecurityTest.php149
-rw-r--r--tests/lib/Settings/Admin/ServerTest.php85
-rw-r--r--tests/lib/Settings/Admin/SharingTest.php271
-rw-r--r--tests/lib/Settings/ManagerTest.php9
-rw-r--r--tests/lib/Settings/Personal/SecurityTest.php120
-rw-r--r--tests/lib/Settings/SectionTest.php2
12 files changed, 20 insertions, 771 deletions
diff --git a/tests/lib/App/AppManagerTest.php b/tests/lib/App/AppManagerTest.php
index 371c2373f81..0e3410b8f20 100644
--- a/tests/lib/App/AppManagerTest.php
+++ b/tests/lib/App/AppManagerTest.php
@@ -385,6 +385,7 @@ class AppManagerTest extends TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'test1',
'test3',
'twofactor_backupcodes',
@@ -412,6 +413,7 @@ class AppManagerTest extends TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'test1',
'test3',
'twofactor_backupcodes',
@@ -439,6 +441,7 @@ class AppManagerTest extends TestCase {
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
'test4' => ['id' => 'test4', 'version' => '3.0.0', 'requiremin' => '8.1.0'],
'testnoversion' => ['id' => 'testnoversion', 'requiremin' => '8.2.0'],
+ 'settings' => ['id' => 'settings'],
'twofactor_backupcodes' => ['id' => 'twofactor_backupcodes'],
'workflowengine' => ['id' => 'workflowengine'],
'oauth2' => ['id' => 'oauth2'],
@@ -485,6 +488,7 @@ class AppManagerTest extends TestCase {
'test1' => ['id' => 'test1', 'version' => '1.0.1', 'requiremax' => '8.0.0'],
'test2' => ['id' => 'test2', 'version' => '1.0.0', 'requiremin' => '8.2.0'],
'test3' => ['id' => 'test3', 'version' => '1.2.4', 'requiremin' => '9.0.0'],
+ 'settings' => ['id' => 'settings'],
'testnoversion' => ['id' => 'testnoversion', 'requiremin' => '8.2.0'],
'twofactor_backupcodes' => ['id' => 'twofactor_backupcodes'],
'workflowengine' => ['id' => 'workflowengine'],
@@ -528,6 +532,7 @@ class AppManagerTest extends TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'test1',
'test3',
'twofactor_backupcodes',
diff --git a/tests/lib/AppFramework/AppTest.php b/tests/lib/AppFramework/AppTest.php
index 3917cea68dd..b9c0f47216a 100644
--- a/tests/lib/AppFramework/AppTest.php
+++ b/tests/lib/AppFramework/AppTest.php
@@ -202,7 +202,7 @@ class AppTest extends \Test\TestCase {
public function testSettingsApp() {
$this->container['AppName'] = 'settings';
- $this->container['OC\Settings\Controller\Foo'] = $this->controller;
+ $this->container['OCA\Settings\Controller\Foo'] = $this->controller;
$return = ['HTTP/2.0 200 OK', [], [], null, new Response()];
$this->dispatcher->expects($this->once())
diff --git a/tests/lib/AppTest.php b/tests/lib/AppTest.php
index 954ffcfae7f..0848f307230 100644
--- a/tests/lib/AppTest.php
+++ b/tests/lib/AppTest.php
@@ -344,6 +344,7 @@ class AppTest extends \Test\TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'twofactor_backupcodes',
'workflowengine',
),
@@ -364,6 +365,7 @@ class AppTest extends \Test\TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'twofactor_backupcodes',
'workflowengine',
),
@@ -385,6 +387,7 @@ class AppTest extends \Test\TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'twofactor_backupcodes',
'workflowengine',
),
@@ -406,6 +409,7 @@ class AppTest extends \Test\TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'twofactor_backupcodes',
'workflowengine',
),
@@ -427,6 +431,7 @@ class AppTest extends \Test\TestCase {
'lookup_server_connector',
'oauth2',
'provisioning_api',
+ 'settings',
'twofactor_backupcodes',
'workflowengine',
),
@@ -506,11 +511,11 @@ class AppTest extends \Test\TestCase {
);
$apps = \OC_App::getEnabledApps();
- $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'twofactor_backupcodes', 'workflowengine'), $apps);
+ $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'workflowengine'), $apps);
// mock should not be called again here
$apps = \OC_App::getEnabledApps();
- $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'twofactor_backupcodes', 'workflowengine'), $apps);
+ $this->assertEquals(array('files', 'app3', 'cloud_federation_api', 'dav', 'federatedfilesharing', 'lookup_server_connector', 'oauth2', 'provisioning_api', 'settings', 'twofactor_backupcodes', 'workflowengine'), $apps);
$this->restoreAppConfig();
\OC_User::setUserId(null);
diff --git a/tests/lib/InfoXmlTest.php b/tests/lib/InfoXmlTest.php
index 3d740cd39dd..0d528dbb652 100644
--- a/tests/lib/InfoXmlTest.php
+++ b/tests/lib/InfoXmlTest.php
@@ -46,6 +46,7 @@ class InfoXmlTest extends TestCase {
['provisioning_api'],
['systemtags'],
['theming'],
+ ['settings'],
['twofactor_backupcodes'],
['updatenotification'],
['user_ldap'],
diff --git a/tests/lib/L10N/FactoryTest.php b/tests/lib/L10N/FactoryTest.php
index be842cf12c7..6b9bd053568 100644
--- a/tests/lib/L10N/FactoryTest.php
+++ b/tests/lib/L10N/FactoryTest.php
@@ -441,7 +441,7 @@ class FactoryTest extends TestCase {
[null, 'de', [\OC::$SERVERROOT . '/core/l10n/de.json']],
['core', 'ru', [\OC::$SERVERROOT . '/core/l10n/ru.json']],
['lib', 'ru', [\OC::$SERVERROOT . '/lib/l10n/ru.json']],
- ['settings', 'de', [\OC::$SERVERROOT . '/settings/l10n/de.json']],
+ ['settings', 'de', [\OC::$SERVERROOT . '/apps/settings/l10n/de.json']],
['files', 'de', [\OC::$SERVERROOT . '/apps/files/l10n/de.json']],
['files', '_lang_never_exists_', []],
['_app_never_exists_', 'de', [\OC::$SERVERROOT . '/core/l10n/de.json']],
@@ -464,7 +464,7 @@ class FactoryTest extends TestCase {
[null, \OC::$SERVERROOT . '/core/l10n/'],
['core', \OC::$SERVERROOT . '/core/l10n/'],
['lib', \OC::$SERVERROOT . '/lib/l10n/'],
- ['settings', \OC::$SERVERROOT . '/settings/l10n/'],
+ ['settings', \OC::$SERVERROOT . '/apps/settings/l10n/'],
['files', \OC::$SERVERROOT . '/apps/files/l10n/'],
['_app_never_exists_', \OC::$SERVERROOT . '/core/l10n/'],
];
diff --git a/tests/lib/Settings/Admin/MailTest.php b/tests/lib/Settings/Admin/MailTest.php
deleted file mode 100644
index 1a1d090418e..00000000000
--- a/tests/lib/Settings/Admin/MailTest.php
+++ /dev/null
@@ -1,134 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\Additional;
-use OC\Settings\Admin\Mail;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use Test\TestCase;
-
-class MailTest extends TestCase {
- /** @var Additional */
- private $admin;
- /** @var IConfig */
- private $config;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
-
- $this->admin = new Mail(
- $this->config
- );
- }
-
- public function testGetForm() {
- $this->config
- ->expects($this->at(0))
- ->method('getSystemValue')
- ->with('mail_domain', '')
- ->willReturn('mx.nextcloud.com');
- $this->config
- ->expects($this->at(1))
- ->method('getSystemValue')
- ->with('mail_from_address', '')
- ->willReturn('no-reply@nextcloud.com');
- $this->config
- ->expects($this->at(2))
- ->method('getSystemValue')
- ->with('mail_smtpmode', '')
- ->willReturn('smtp');
- $this->config
- ->expects($this->at(3))
- ->method('getSystemValue')
- ->with('mail_smtpsecure', '')
- ->willReturn(true);
- $this->config
- ->expects($this->at(4))
- ->method('getSystemValue')
- ->with('mail_smtphost', '')
- ->willReturn('smtp.nextcloud.com');
- $this->config
- ->expects($this->at(5))
- ->method('getSystemValue')
- ->with('mail_smtpport', '')
- ->willReturn(25);
- $this->config
- ->expects($this->at(6))
- ->method('getSystemValue')
- ->with('mail_smtpauthtype', '')
- ->willReturn('login');
- $this->config
- ->expects($this->at(7))
- ->method('getSystemValue')
- ->with('mail_smtpauth', false)
- ->willReturn(true);
- $this->config
- ->expects($this->at(8))
- ->method('getSystemValue')
- ->with('mail_smtpname', '')
- ->willReturn('smtp.sender.com');
- $this->config
- ->expects($this->at(9))
- ->method('getSystemValue')
- ->with('mail_smtppassword', '')
- ->willReturn('mypassword');
- $this->config
- ->expects($this->at(10))
- ->method('getSystemValue')
- ->with('mail_sendmailmode', 'smtp')
- ->willReturn('smtp');
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/additional-mail',
- [
- 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'),
- 'mail_domain' => 'mx.nextcloud.com',
- 'mail_from_address' => 'no-reply@nextcloud.com',
- 'mail_smtpmode' => 'smtp',
- 'mail_smtpsecure' => true,
- 'mail_smtphost' => 'smtp.nextcloud.com',
- 'mail_smtpport' => 25,
- 'mail_smtpauthtype' => 'login',
- 'mail_smtpauth' => true,
- 'mail_smtpname' => 'smtp.sender.com',
- 'mail_smtppassword' => '********',
- 'mail_sendmailmode' => 'smtp',
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('server', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(10, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/Admin/SecurityTest.php b/tests/lib/Settings/Admin/SecurityTest.php
deleted file mode 100644
index 6a9d84bd40d..00000000000
--- a/tests/lib/Settings/Admin/SecurityTest.php
+++ /dev/null
@@ -1,149 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Authentication\TwoFactorAuth\MandatoryTwoFactor;
-use OC\Encryption\Manager;
-use OC\Settings\Admin\Security;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IInitialStateService;
-use OCP\IUserManager;
-use PHPUnit\Framework\MockObject\MockObject;
-use Test\TestCase;
-
-class SecurityTest extends TestCase {
- /** @var Security */
- private $admin;
- /** @var Manager */
- private $manager;
- /** @var IUserManager */
- private $userManager;
- /** @var MandatoryTwoFactor|MockObject */
- private $mandatoryTwoFactor;
- /** @var IInitialStateService|MockObject */
- private $initialState;
-
- public function setUp() {
- parent::setUp();
- $this->manager = $this->getMockBuilder('\OC\Encryption\Manager')->disableOriginalConstructor()->getMock();
- $this->userManager = $this->getMockBuilder(IUserManager::class)->getMock();
- $this->mandatoryTwoFactor = $this->createMock(MandatoryTwoFactor::class);
- $this->initialState = $this->createMock(IInitialStateService::class);
-
- $this->admin = new Security(
- $this->manager,
- $this->userManager,
- $this->mandatoryTwoFactor,
- $this->initialState
- );
- }
-
- /**
- * @return array
- */
- public function encryptionSettingsProvider() {
- return [
- [true],
- [false],
- ];
- }
-
- /**
- * @dataProvider encryptionSettingsProvider
- * @param bool $enabled
- */
- public function testGetFormWithOnlyOneBackend($enabled) {
- $this->manager
- ->expects($this->once())
- ->method('isEnabled')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('isReady')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('getEncryptionModules')
- ->willReturn([]);
- $this->userManager
- ->expects($this->once())
- ->method('getBackends')
- ->willReturn(['entry']);
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/security',
- [
- 'encryptionEnabled' => $enabled,
- 'encryptionReady' => $enabled,
- 'externalBackendsEnabled' => false,
- 'encryptionModules' => []
- ],
- ''
- );
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- /**
- * @dataProvider encryptionSettingsProvider
- * @param bool $enabled
- */
- public function testGetFormWithMultipleBackends($enabled) {
- $this->manager
- ->expects($this->once())
- ->method('isEnabled')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('isReady')
- ->willReturn($enabled);
- $this->manager
- ->expects($this->once())
- ->method('getEncryptionModules')
- ->willReturn([]);
- $this->userManager
- ->expects($this->once())
- ->method('getBackends')
- ->willReturn(['entry', 'entry']);
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/security',
- [
- 'encryptionEnabled' => $enabled,
- 'encryptionReady' => $enabled,
- 'externalBackendsEnabled' => true,
- 'encryptionModules' => []
- ],
- ''
- );
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('security', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(10, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php
deleted file mode 100644
index adf8ef4f363..00000000000
--- a/tests/lib/Settings/Admin/ServerTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\Server;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use Test\TestCase;
-
-class ServerTest extends TestCase {
- /** @var Server */
- private $admin;
- /** @var IConfig */
- private $config;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->createMock(IConfig::class);
-
- $this->admin = new Server(
- $this->config
- );
- }
-
- public function testGetForm() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'backgroundjobs_mode', 'ajax')
- ->willReturn('ajax');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'lastcron', false)
- ->willReturn(false);
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'cronErrors')
- ->willReturn('');
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/server',
- [
- 'backgroundjobs_mode' => 'ajax',
- 'lastcron' => false,
- 'cronErrors' => '',
- 'cli_based_cron_possible' => true,
- 'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', // to not explode here because of posix extension not being disabled - which is already checked in the line above
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('server', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(0, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php
deleted file mode 100644
index c40ff98a869..00000000000
--- a/tests/lib/Settings/Admin/SharingTest.php
+++ /dev/null
@@ -1,271 +0,0 @@
-<?php
-/**
- * @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
- *
- * @author Lukas Reschke <lukas@statuscode.ch>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Test\Settings\Admin;
-
-use OC\Settings\Admin\Sharing;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\Constants;
-use OCP\IConfig;
-use OCP\IL10N;
-use OCP\L10N\IFactory;
-use OCP\Share\IManager;
-use Test\TestCase;
-
-class SharingTest extends TestCase {
- /** @var Sharing */
- private $admin;
- /** @var IConfig */
- private $config;
- /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */
- private $l10n;
- /** @var IManager|\PHPUnit_Framework_MockObject_MockObject */
- private $shareManager;
-
- public function setUp() {
- parent::setUp();
- $this->config = $this->getMockBuilder(IConfig::class)->getMock();
- $this->l10n = $this->getMockBuilder(IL10N::class)->getMock();
-
- $l10Factory = $this->createMock(IFactory::class);
- $l10Factory->method('get')
- ->willReturn($this->l10n);
-
- $this->shareManager = $this->getMockBuilder(IManager::class)->getMock();
-
- $this->admin = new Sharing(
- $this->config,
- $l10Factory,
- $this->shareManager
- );
- }
-
- public function testGetFormWithoutExcludedGroups() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups_list', '')
- ->willReturn('');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_group_sharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_links', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_public_upload', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(4))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_resharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(5))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(6))
- ->method('getAppValue')
- ->with('core', 'shareapi_enabled', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(7))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(8))
- ->method('getAppValue')
- ->with('core', 'shareapi_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(9))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(10))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(11))
- ->method('getAppValue')
- ->with('core', 'shareapi_public_link_disclaimertext', null)
- ->willReturn('Lorem ipsum');
- $this->config
- ->expects($this->at(12))
- ->method('getAppValue')
- ->with('core', 'shareapi_enable_link_password_by_default', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(13))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
- ->willReturn(Constants::PERMISSION_ALL);
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/sharing',
- [
- 'allowGroupSharing' => 'yes',
- 'allowLinks' => 'yes',
- 'allowPublicUpload' => 'yes',
- 'allowResharing' => 'yes',
- 'allowShareDialogUserEnumeration' => 'yes',
- 'enforceLinkPassword' => false,
- 'onlyShareWithGroupMembers' => false,
- 'shareAPIEnabled' => 'yes',
- 'shareDefaultExpireDateSet' => 'no',
- 'shareExpireAfterNDays' => '7',
- 'shareEnforceExpireDate' => 'no',
- 'shareExcludeGroups' => false,
- 'shareExcludedGroupsList' => '',
- 'publicShareDisclaimerText' => 'Lorem ipsum',
- 'enableLinkPasswordByDefault' => 'yes',
- 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL,
- 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', [])
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetFormWithExcludedGroups() {
- $this->config
- ->expects($this->at(0))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups_list', '')
- ->willReturn('["NoSharers","OtherNoSharers"]');
- $this->config
- ->expects($this->at(1))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_group_sharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(2))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_links', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(3))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_public_upload', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(4))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_resharing', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(5))
- ->method('getAppValue')
- ->with('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(6))
- ->method('getAppValue')
- ->with('core', 'shareapi_enabled', 'yes')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(7))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(8))
- ->method('getAppValue')
- ->with('core', 'shareapi_expire_after_n_days', '7')
- ->willReturn('7');
- $this->config
- ->expects($this->at(9))
- ->method('getAppValue')
- ->with('core', 'shareapi_enforce_expire_date', 'no')
- ->willReturn('no');
- $this->config
- ->expects($this->at(10))
- ->method('getAppValue')
- ->with('core', 'shareapi_exclude_groups', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(11))
- ->method('getAppValue')
- ->with('core', 'shareapi_public_link_disclaimertext', null)
- ->willReturn('Lorem ipsum');
- $this->config
- ->expects($this->at(12))
- ->method('getAppValue')
- ->with('core', 'shareapi_enable_link_password_by_default', 'no')
- ->willReturn('yes');
- $this->config
- ->expects($this->at(13))
- ->method('getAppValue')
- ->with('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL)
- ->willReturn(Constants::PERMISSION_ALL);
-
-
- $expected = new TemplateResponse(
- 'settings',
- 'settings/admin/sharing',
- [
- 'allowGroupSharing' => 'yes',
- 'allowLinks' => 'yes',
- 'allowPublicUpload' => 'yes',
- 'allowResharing' => 'yes',
- 'allowShareDialogUserEnumeration' => 'yes',
- 'enforceLinkPassword' => false,
- 'onlyShareWithGroupMembers' => false,
- 'shareAPIEnabled' => 'yes',
- 'shareDefaultExpireDateSet' => 'no',
- 'shareExpireAfterNDays' => '7',
- 'shareEnforceExpireDate' => 'no',
- 'shareExcludeGroups' => true,
- 'shareExcludedGroupsList' => 'NoSharers|OtherNoSharers',
- 'publicShareDisclaimerText' => 'Lorem ipsum',
- 'enableLinkPasswordByDefault' => 'yes',
- 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL,
- 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', [])
- ],
- ''
- );
-
- $this->assertEquals($expected, $this->admin->getForm());
- }
-
- public function testGetSection() {
- $this->assertSame('sharing', $this->admin->getSection());
- }
-
- public function testGetPriority() {
- $this->assertSame(0, $this->admin->getPriority());
- }
-}
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php
index 2b2b2250695..ed02061c595 100644
--- a/tests/lib/Settings/ManagerTest.php
+++ b/tests/lib/Settings/ManagerTest.php
@@ -21,13 +21,11 @@
*
*/
-namespace Tests\Settings;
+namespace OCA\Settings\Tests\AppInfo;
-use function get_class;
-use OC\Settings\Admin\Sharing;
+use OCA\Settings\Admin\Sharing;
use OC\Settings\Manager;
-use OC\Settings\Mapper;
-use OC\Settings\Personal\Security;
+use OCA\Settings\Personal\Security;
use OC\Settings\Section;
use OCP\IDBConnection;
use OCP\IL10N;
@@ -35,7 +33,6 @@ use OCP\ILogger;
use OCP\IServerContainer;
use OCP\IURLGenerator;
use OCP\L10N\IFactory;
-use OCP\Settings\ISettings;
use OCP\Settings\ISubAdminSettings;
use Test\TestCase;
diff --git a/tests/lib/Settings/Personal/SecurityTest.php b/tests/lib/Settings/Personal/SecurityTest.php
deleted file mode 100644
index 012c1d87a1f..00000000000
--- a/tests/lib/Settings/Personal/SecurityTest.php
+++ /dev/null
@@ -1,120 +0,0 @@
-<?php
-declare(strict_types=1);
-
-/**
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-namespace Test\Settings\Personal;
-
-use OC\Authentication\TwoFactorAuth\ProviderLoader;
-use OCP\IInitialStateService;
-use OCP\InitialStateService;
-use OC\Settings\Personal\Security;
-use OCP\AppFramework\Http\TemplateResponse;
-use OCP\IConfig;
-use OCP\IUser;
-use OCP\IUserManager;
-use OCP\IUserSession;
-use PHPUnit\Framework\MockObject\MockObject;
-use Test\TestCase;
-
-class SecurityTest extends TestCase {
-
- /** @var InitialStateService|MockObject */
- private $initialStateService;
-
- /** @var IUserManager|MockObject */
- private $userManager;
-
- /** @var ProviderLoader|MockObject */
- private $providerLoader;
-
- /** @var IUserSession|MockObject */
- private $userSession;
-
- /** @var IConfig|MockObject */
- private $config;
-
- /** @var string */
- private $uid;
-
- /** @var Security */
- private $section;
-
- public function setUp() {
- parent::setUp();
-
- $this->initialStateService = $this->createMock(IInitialStateService::class);
- $this->userManager = $this->createMock(IUserManager::class);
- $this->providerLoader = $this->createMock(ProviderLoader::class);
- $this->userSession = $this->createMock(IUserSession::class);
- $this->config = $this->createMock(IConfig::class);
- $this->uid = 'test123';
-
- $this->section = new Security(
- $this->initialStateService,
- $this->userManager,
- $this->providerLoader,
- $this->userSession,
- $this->config,
- $this->uid
- );
- }
-
- public function testGetForm() {
- $user = $this->createMock(IUser::class);
- $this->userManager->expects($this->once())
- ->method('get')
- ->with($this->uid)
- ->willReturn($user);
- $user->expects($this->once())
- ->method('canChangePassword')
- ->willReturn(true);
- $this->userSession->expects($this->once())
- ->method('getUser')
- ->willReturn($user);
- $this->providerLoader->expects($this->once())
- ->method('getProviders')
- ->with($user)
- ->willReturn([]);
- $this->config->expects($this->once())
- ->method('getUserValue')
- ->with(
- $this->uid,
- 'accessibility',
- 'theme',
- false
- )
- ->willReturn(false);
-
- $form = $this->section->getForm();
-
- $expected = new TemplateResponse('settings', 'settings/personal/security', [
- 'passwordChangeSupported' => true,
- 'twoFactorProviderData' => [
- 'providers' => [],
- ],
- 'themedark' => false,
- ]);
- $this->assertEquals($expected, $form);
- }
-
-}
diff --git a/tests/lib/Settings/SectionTest.php b/tests/lib/Settings/SectionTest.php
index 422b931bb4b..70606135630 100644
--- a/tests/lib/Settings/SectionTest.php
+++ b/tests/lib/Settings/SectionTest.php
@@ -21,7 +21,7 @@
*
*/
-namespace Tests\Settings;
+namespace OCA\Settings\Tests\AppInfo;
use OC\Settings\Section;
use Test\TestCase;