diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-09-25 11:24:23 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-09-25 20:12:41 +0200 |
commit | db0217362783b4cdd51122e34b1e39c4ff79e09a (patch) | |
tree | e4be08a041d24005f68f7fc3ff513131891bbe54 /apps/files_sharing/tests/capabilities.php | |
parent | 0aaece7de7584f9f6ae1144ef05abc5a32d95403 (diff) | |
download | nextcloud-server-db0217362783b4cdd51122e34b1e39c4ff79e09a.tar.gz nextcloud-server-db0217362783b4cdd51122e34b1e39c4ff79e09a.zip |
Reflect enabled shareAPI in capabilities
If the shareAPI is disabled we not return the other sharing
capabilities.
This allows clients to properly check if sharing is even available.
Diffstat (limited to 'apps/files_sharing/tests/capabilities.php')
-rw-r--r-- | apps/files_sharing/tests/capabilities.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/capabilities.php b/apps/files_sharing/tests/capabilities.php index f1a9626db9b..cff7bdf1fe8 100644 --- a/apps/files_sharing/tests/capabilities.php +++ b/apps/files_sharing/tests/capabilities.php @@ -56,8 +56,31 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { return $result; } + public function testEnabledSharingAPI() { + $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], + ]; + $result = $this->getResults($map); + $this->assertTrue($result['api_enabled']); + $this->assertContains('public', $result); + $this->assertContains('user', $result); + $this->assertContains('resharing', $result); + } + + public function testDisabledSharingAPI() { + $map = [ + ['core', 'shareapi_enabled', 'yes', 'no'], + ]; + $result = $this->getResults($map); + $this->assertFalse($result['api_enabled']); + $this->assertNotContains('public', $result); + $this->assertNotContains('user', $result); + $this->assertNotContains('resharing', $result); + } + public function testNoLinkSharing() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'no'], ]; $result = $this->getResults($map); @@ -67,6 +90,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testOnlyLinkSharing() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ]; $result = $this->getResults($map); @@ -76,6 +100,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkPassword() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_enforce_links_password', 'no', 'yes'], ]; @@ -87,6 +112,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkNoPassword() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_enforce_links_password', 'no', 'no'], ]; @@ -98,6 +124,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkNoExpireDate() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_default_expire_date', 'no', 'no'], ]; @@ -109,6 +136,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkExpireDate() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_default_expire_date', 'no', 'yes'], ['core', 'shareapi_expire_after_n_days', '7', '7'], @@ -124,6 +152,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkExpireDateEnforced() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_default_expire_date', 'no', 'yes'], ['core', 'shareapi_enforce_expire_date', 'no', 'yes'], @@ -136,6 +165,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkSendMail() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_notification', 'no', 'yes'], ]; @@ -145,6 +175,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkNoSendMail() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_notification', 'no', 'no'], ]; @@ -154,6 +185,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testUserSendMail() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_mail_notification', 'no', 'yes'], ]; $result = $this->getResults($map); @@ -162,6 +194,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testUserNoSendMail() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_mail_notification', 'no', 'no'], ]; $result = $this->getResults($map); @@ -170,6 +203,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testResharing() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'yes'], ]; $result = $this->getResults($map); @@ -178,6 +212,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testNoResharing() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_resharing', 'yes', 'no'], ]; $result = $this->getResults($map); @@ -186,6 +221,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkPublicUpload() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_upload', 'yes', 'yes'], ]; @@ -195,6 +231,7 @@ class FilesSharingCapabilitiesTest extends \Test\TestCase { public function testLinkNoPublicUpload() { $map = [ + ['core', 'shareapi_enabled', 'yes', 'yes'], ['core', 'shareapi_allow_links', 'yes', 'yes'], ['core', 'shareapi_allow_public_upload', 'yes', 'no'], ]; |