summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests
diff options
context:
space:
mode:
authorMaxence Lange <maxence@nextcloud.com>2017-03-17 18:48:33 -0100
committerMaxence Lange <maxence@nextcloud.com>2017-03-17 18:48:33 -0100
commit69694012ab0eca1ec1f3dc0d2b10a3b1728b0927 (patch)
treef79ec80ba1eefb73884c723718d8fa5c76cbf203 /apps/files_sharing/tests
parent3c66ad64e626cb602685a640c235d472f0777a53 (diff)
downloadnextcloud-server-69694012ab0eca1ec1f3dc0d2b10a3b1728b0927.tar.gz
nextcloud-server-69694012ab0eca1ec1f3dc0d2b10a3b1728b0927.zip
shares-circles
Signed-off-by: Maxence Lange <maxence@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r--apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php18
-rw-r--r--apps/files_sharing/tests/MountProviderTest.php12
-rw-r--r--apps/files_sharing/tests/js/sharedbreadcrumviewSpec.js18
3 files changed, 41 insertions, 7 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
index 035085d811a..e3d869db3d6 100644
--- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
@@ -1576,20 +1576,22 @@ class ShareesAPIControllerTest extends TestCase {
return [
['test', 'folder', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, false, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
[
- 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []],
+ 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'circles' => [], 'emails' => []],
'users' => [],
'groups' => [],
'remotes' => [],
'emails' => [],
+ 'circles' => [],
'lookup' => [],
], false],
['test', 'folder', [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE], 1, 2, false, [], [], ['results' => [], 'exact' => [], 'exactIdMatch' => false],
[
- 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []],
+ 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'circles' => [], 'emails' => []],
'users' => [],
'groups' => [],
'remotes' => [],
'emails' => [],
+ 'circles' => [],
'lookup' => [],
], false],
[
@@ -1601,7 +1603,7 @@ class ShareesAPIControllerTest extends TestCase {
'results' => [['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false,
],
[
- 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []],
+ 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'circles' => [], 'emails' => []],
'users' => [
['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
],
@@ -1612,6 +1614,7 @@ class ShareesAPIControllerTest extends TestCase {
['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']],
],
'emails' => [],
+ 'circles' => [],
'lookup' => [],
], true,
],
@@ -1623,7 +1626,7 @@ class ShareesAPIControllerTest extends TestCase {
'results' => [['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']]], 'exact' => [], 'exactIdMatch' => false
],
[
- 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []],
+ 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'circles' => [], 'emails' => []],
'users' => [
['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
],
@@ -1632,6 +1635,7 @@ class ShareesAPIControllerTest extends TestCase {
['label' => 'testz@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'testz@remote']],
],
'emails' => [],
+ 'circles' => [],
'lookup' => [],
], false,
],
@@ -1641,13 +1645,14 @@ class ShareesAPIControllerTest extends TestCase {
['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
], null, null,
[
- 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []],
+ 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'circles' => [], 'emails' => []],
'users' => [
['label' => 'test One', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
],
'groups' => [],
'remotes' => [],
'emails' => [],
+ 'circles' => [],
'lookup' => [],
], false,
],
@@ -1658,7 +1663,7 @@ class ShareesAPIControllerTest extends TestCase {
['label' => 'test 2', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
], null, null,
[
- 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'emails' => []],
+ 'exact' => ['users' => [], 'groups' => [], 'remotes' => [], 'circles' => [], 'emails' => []],
'users' => [
['label' => 'test 1', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test1']],
['label' => 'test 2', 'value' => ['shareType' => Share::SHARE_TYPE_USER, 'shareWith' => 'test2']],
@@ -1666,6 +1671,7 @@ class ShareesAPIControllerTest extends TestCase {
'groups' => [],
'remotes' => [],
'emails' => [],
+ 'circles' => [],
'lookup' => [],
], true,
],
diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php
index 0be74a645a9..1c83d91d08f 100644
--- a/apps/files_sharing/tests/MountProviderTest.php
+++ b/apps/files_sharing/tests/MountProviderTest.php
@@ -113,6 +113,8 @@ class MountProviderTest extends \Test\TestCase {
$this->makeMockShare(4, 101, 'user2', '/share4', 31),
$this->makeMockShare(5, 100, 'user1', '/share4', 31),
];
+ // tests regarding circles are made in the app itself.
+ $circleShares = [];
$this->user->expects($this->any())
->method('getUID')
->will($this->returnValue('user1'));
@@ -124,6 +126,10 @@ class MountProviderTest extends \Test\TestCase {
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)
->will($this->returnValue($groupShares));
+ $this->shareManager->expects($this->at(2))
+ ->method('getSharedWith')
+ ->with('user1', \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)
+ ->will($this->returnValue($circleShares));
$this->shareManager->expects($this->any())
->method('newShare')
->will($this->returnCallback(function() use ($rootFolder, $userManager) {
@@ -293,6 +299,8 @@ class MountProviderTest extends \Test\TestCase {
->method('getUID')
->will($this->returnValue('user1'));
+ // tests regarding circles are made in the app itself.
+ $circleShares = [];
$this->shareManager->expects($this->at(0))
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_USER)
@@ -301,6 +309,10 @@ class MountProviderTest extends \Test\TestCase {
->method('getSharedWith')
->with('user1', \OCP\Share::SHARE_TYPE_GROUP, null, -1)
->will($this->returnValue($groupShares));
+ $this->shareManager->expects($this->at(2))
+ ->method('getSharedWith')
+ ->with('user1', \OCP\Share::SHARE_TYPE_CIRCLE, null, -1)
+ ->will($this->returnValue($circleShares));
$this->shareManager->expects($this->any())
->method('newShare')
->will($this->returnCallback(function() use ($rootFolder, $userManager) {
diff --git a/apps/files_sharing/tests/js/sharedbreadcrumviewSpec.js b/apps/files_sharing/tests/js/sharedbreadcrumviewSpec.js
index b2193f4458b..501dd819fa8 100644
--- a/apps/files_sharing/tests/js/sharedbreadcrumviewSpec.js
+++ b/apps/files_sharing/tests/js/sharedbreadcrumviewSpec.js
@@ -120,6 +120,21 @@ describe('OCA.Sharing.ShareBreadCrumbView tests', function() {
expect(bc.$el.find('.shared').length).toEqual(1);
expect(bc.$el.find('.icon-public').length).toEqual(1);
});
+ it('Render shared if dir is shared by circle', function() {
+ var dirInfo = new OC.Files.FileInfo({
+ id: 42,
+ path: '/foo',
+ type: 'dir',
+ shareTypes: [OC.Share.SHARE_TYPE_CIRCLE]
+ });
+ bc.setDirectoryInfo(dirInfo);
+ bc.setDirectory('/foo');
+ bc.render();
+ expect(bc.$el.hasClass('breadcrumb')).toEqual(true);
+ expect(bc.$el.find('.icon-share').length).toEqual(1);
+ expect(bc.$el.find('.shared').length).toEqual(1);
+ expect(bc.$el.find('.icon-public').length).toEqual(0);
+ });
it('Render shared if dir is shared with remote', function() {
var dirInfo = new OC.Files.FileInfo({
id: 42,
@@ -145,7 +160,8 @@ describe('OCA.Sharing.ShareBreadCrumbView tests', function() {
OC.Share.SHARE_TYPE_GROUP,
OC.Share.SHARE_TYPE_LINK,
OC.Share.SHARE_TYPE_EMAIL,
- OC.Share.SHARE_TYPE_REMOTE
+ OC.Share.SHARE_TYPE_REMOTE,
+ OC.Share.SHARE_TYPE_CIRCLE
]
});
bc.setDirectoryInfo(dirInfo);