summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-01-13 13:02:23 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-01-13 16:35:15 +0100
commitcbd3050f4c5d0c98cc627cfab5d1ab8b85f1ae7c (patch)
tree50e58fd40b41fc11f4d669591b9d816fe0e06716 /apps/files_sharing/tests
parent67b7ebccd134d68329fae201669924118a4d98fc (diff)
downloadnextcloud-server-cbd3050f4c5d0c98cc627cfab5d1ab8b85f1ae7c.tar.gz
nextcloud-server-cbd3050f4c5d0c98cc627cfab5d1ab8b85f1ae7c.zip
[Share 2.0] Use full share id (providerId:shareId)
Now that we support multiple managers we communicate shares to the outside as 'providerId:shareId'. This makes sures that id's are unique when references from the OCS API. However, since we do not want to break the OCS API v1 we need to somewhat hack around this. When we switch to OCS API v2 (which we should when we support more custom providers). We will change the id to always be the fullShareId.
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/api/share20ocstest.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/apps/files_sharing/tests/api/share20ocstest.php b/apps/files_sharing/tests/api/share20ocstest.php
index b594d253eb2..81166b9e3c4 100644
--- a/apps/files_sharing/tests/api/share20ocstest.php
+++ b/apps/files_sharing/tests/api/share20ocstest.php
@@ -82,7 +82,7 @@ class Share20OCSTest extends \Test\TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with(42)
+ ->with('ocinternal:42')
->will($this->throwException(new \OC\Share20\Exception\ShareNotFound()));
$expected = new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
@@ -95,7 +95,7 @@ class Share20OCSTest extends \Test\TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with(42)
+ ->with('ocinternal:42')
->willReturn($share);
$this->shareManager
->expects($this->once())
@@ -114,7 +114,7 @@ class Share20OCSTest extends \Test\TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with(42)
+ ->with('ocinternal:42')
->willReturn($share);
$this->shareManager
->expects($this->once())
@@ -125,16 +125,20 @@ class Share20OCSTest extends \Test\TestCase {
$this->assertEquals($expected, $this->ocs->deleteShare(42));
}
+ /*
+ * FIXME: Enable once we have a federated Share Provider
+
public function testGetGetShareNotExists() {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with(42)
+ ->with('ocinternal:42')
->will($this->throwException(new \OC\Share20\Exception\ShareNotFound()));
$expected = new \OC_OCS_Result(null, 404, 'wrong share ID, share doesn\'t exist.');
$this->assertEquals($expected, $this->ocs->getShare(42));
}
+ */
public function createShare($id, $shareType, $sharedWith, $sharedBy, $shareOwner, $path, $permissions,
$shareTime, $expiration, $parent, $target, $mail_send, $token=null,
@@ -155,6 +159,12 @@ class Share20OCSTest extends \Test\TestCase {
$share->method('getToken')->willReturn($token);
$share->method('getPassword')->willReturn($password);
+ if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
+ $shareType === \OCP\Share::SHARE_TYPE_GROUP ||
+ $shareType === \OCP\Share::SHARE_TYPE_LINK) {
+ $share->method('getFullId')->willReturn('ocinternal:'.$id);
+ }
+
return $share;
}
@@ -345,7 +355,7 @@ class Share20OCSTest extends \Test\TestCase {
$this->shareManager
->expects($this->once())
->method('getShareById')
- ->with($share->getId())
+ ->with($share->getFullId())
->willReturn($share);
$userFolder = $this->getMock('OCP\Files\Folder');