summaryrefslogtreecommitdiffstats
path: root/tests/lib/share20/managertest.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-06 11:34:12 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-06 15:25:29 +0100
commit1358e5dcd9af0ecace07115a790544a22d5eb3bd (patch)
tree88e1d8fd359f4c645da23436cee02b2aaa9aa7f5 /tests/lib/share20/managertest.php
parent26280e1f1965cd50325a05715989b1c0f7e508d0 (diff)
downloadnextcloud-server-1358e5dcd9af0ecace07115a790544a22d5eb3bd.tar.gz
nextcloud-server-1358e5dcd9af0ecace07115a790544a22d5eb3bd.zip
[Sharing 2.0] Some error cases report 404 instead of 403
Diffstat (limited to 'tests/lib/share20/managertest.php')
-rw-r--r--tests/lib/share20/managertest.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/lib/share20/managertest.php b/tests/lib/share20/managertest.php
index c7f4c0afdf2..57e7e110712 100644
--- a/tests/lib/share20/managertest.php
+++ b/tests/lib/share20/managertest.php
@@ -530,22 +530,24 @@ class ManagerTest extends \Test\TestCase {
$nonShareAble = $this->getMock('\OCP\Files\Folder');
$nonShareAble->method('isShareable')->willReturn(false);
+ $nonShareAble->method('getPath')->willReturn('path');
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonShareAble, $user2, $user, $user, 31, null, null), 'Path is not shareable', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonShareAble, $group, $user, $user, 31, null, null), 'Path is not shareable', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $nonShareAble, null, $user, $user, 31, null, null), 'Path is not shareable', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $nonShareAble, $user2, $user, $user, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $nonShareAble, $group, $user, $user, 31, null, null), 'You are not allowed to share path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $nonShareAble, null, $user, $user, 31, null, null), 'You are not allowed to share path', true];
$limitedPermssions = $this->getMock('\OCP\Files\File');
$limitedPermssions->method('isShareable')->willReturn(true);
$limitedPermssions->method('getPermissions')->willReturn(\OCP\Constants::PERMISSION_READ);
+ $limitedPermssions->method('getPath')->willReturn('path');
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user, $user, null, null, null), 'A share requires permissions', true];
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group, $user, $user, null, null, null), 'A share requires permissions', true];
$data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user, $user, null, null, null), 'A share requires permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user, $user, 31, null, null), 'Cannot increase permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group, $user, $user, 17, null, null), 'Cannot increase permissions', true];
- $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user, $user, 3, null, null), 'Cannot increase permissions', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_USER, $limitedPermssions, $user2, $user, $user, 31, null, null), 'Cannot increase permissions of path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_GROUP, $limitedPermssions, $group, $user, $user, 17, null, null), 'Cannot increase permissions of path', true];
+ $data[] = [$this->createShare(null, \OCP\Share::SHARE_TYPE_LINK, $limitedPermssions, null, $user, $user, 3, null, null), 'Cannot increase permissions of path', true];
$allPermssions = $this->getMock('\OCP\Files\Folder');
$allPermssions->method('isShareable')->willReturn(true);
@@ -574,6 +576,9 @@ class ManagerTest extends \Test\TestCase {
try {
$this->invokePrivate($this->manager, 'generalCreateChecks', [$share]);
$thrown = false;
+ } catch (\OC\HintException $e) {
+ $this->assertEquals($exceptionMessage, $e->getHint());
+ $thrown = true;
} catch(\InvalidArgumentException $e) {
$this->assertEquals($exceptionMessage, $e->getMessage());
$thrown = true;