diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-02-27 13:44:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-27 13:44:34 +0100 |
commit | 7bc3c2e057c8c265ca7b1aa387dd1ba479690143 (patch) | |
tree | c02f1ec27b8037ef2f604829347e7efe2e3d34ab /tests | |
parent | 01f420c7ac38128c03975d7de7dd20190c4afcc1 (diff) | |
parent | 20ec0344a26faf725762e3b344b66bb45ef1a5a2 (diff) | |
download | nextcloud-server-7bc3c2e057c8c265ca7b1aa387dd1ba479690143.tar.gz nextcloud-server-7bc3c2e057c8c265ca7b1aa387dd1ba479690143.zip |
Merge pull request #7363 from nextcloud/default-share-perms
Let the admin configure the default share permissions
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Settings/Admin/SharingTest.php | 27 | ||||
-rw-r--r-- | tests/lib/Settings/ManagerTest.php | 2 |
2 files changed, 25 insertions, 4 deletions
diff --git a/tests/lib/Settings/Admin/SharingTest.php b/tests/lib/Settings/Admin/SharingTest.php index 9498a1466d3..79065fb8d21 100644 --- a/tests/lib/Settings/Admin/SharingTest.php +++ b/tests/lib/Settings/Admin/SharingTest.php @@ -25,7 +25,9 @@ namespace Test\Settings\Admin; use OC\Settings\Admin\Sharing; use OCP\AppFramework\Http\TemplateResponse; +use OCP\Constants; use OCP\IConfig; +use OCP\IL10N; use Test\TestCase; class SharingTest extends TestCase { @@ -33,13 +35,17 @@ class SharingTest extends TestCase { private $admin; /** @var IConfig */ private $config; + /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ + private $l10n; public function setUp() { parent::setUp(); $this->config = $this->getMockBuilder(IConfig::class)->getMock(); + $this->l10n = $this->getMockBuilder(IL10N::class)->getMock(); $this->admin = new Sharing( - $this->config + $this->config, + $this->l10n ); } @@ -109,6 +115,11 @@ class SharingTest extends TestCase { ->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', @@ -128,7 +139,9 @@ class SharingTest extends TestCase { 'shareExcludeGroups' => false, 'shareExcludedGroupsList' => '', 'publicShareDisclaimerText' => 'Lorem ipsum', - 'enableLinkPasswordByDefault' => 'yes' + 'enableLinkPasswordByDefault' => 'yes', + 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL, + 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', []) ], '' ); @@ -202,6 +215,12 @@ class SharingTest extends TestCase { ->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', @@ -221,7 +240,9 @@ class SharingTest extends TestCase { 'shareExcludeGroups' => true, 'shareExcludedGroupsList' => 'NoSharers|OtherNoSharers', 'publicShareDisclaimerText' => 'Lorem ipsum', - 'enableLinkPasswordByDefault' => 'yes' + 'enableLinkPasswordByDefault' => 'yes', + 'shareApiDefaultPermissions' => Constants::PERMISSION_ALL, + 'shareApiDefaultPermissionsCheckboxes' => $this->invokePrivate($this->admin, 'getSharePermissionList', []) ], '' ); diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index 577abc7915c..b218a347e85 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -209,7 +209,7 @@ class ManagerTest extends TestCase { public function testGetAdminSettings() { $this->assertEquals([ - 0 => [new Sharing($this->config)], + 0 => [new Sharing($this->config, $this->l10n)], ], $this->manager->getAdminSettings('sharing')); } |