diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-12-08 17:30:08 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2020-12-09 13:20:26 +0100 |
commit | 676d2b7a947754f4c42405b513658a5f6663673c (patch) | |
tree | 9b5bf25787ac673d67d2409fb3c5f8c3e7a4ed36 /apps/files_sharing/tests | |
parent | b8d2a00b74df2ce3e9f2aec51d7192a10a49ae60 (diff) | |
download | nextcloud-server-676d2b7a947754f4c42405b513658a5f6663673c.tar.gz nextcloud-server-676d2b7a947754f4c42405b513658a5f6663673c.zip |
Adjust mountprovider tests
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/files_sharing/tests')
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareAPIControllerTest.php | 4 | ||||
-rw-r--r-- | apps/files_sharing/tests/MountProviderTest.php | 24 |
2 files changed, 25 insertions, 3 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 1759e532810..729fe27f69e 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -196,10 +196,10 @@ class ShareAPIControllerTest extends TestCase { $this->expectExceptionMessage('Wrong share ID, share doesn\'t exist'); $this->shareManager - ->expects($this->exactly(5)) + ->expects($this->exactly(6)) ->method('getShareById') ->willReturnCallback(function ($id) { - if ($id === 'ocinternal:42' || $id === 'ocRoomShare:42' || $id === 'ocFederatedSharing:42' || $id === 'ocCircleShare:42' || $id === 'ocMailShare:42') { + if ($id === 'ocinternal:42' || $id === 'ocRoomShare:42' || $id === 'ocFederatedSharing:42' || $id === 'ocCircleShare:42' || $id === 'ocMailShare:42' || $id === 'deck:42') { throw new \OCP\Share\Exceptions\ShareNotFound(); } else { throw new \Exception(); diff --git a/apps/files_sharing/tests/MountProviderTest.php b/apps/files_sharing/tests/MountProviderTest.php index c7116230813..f40bd44331e 100644 --- a/apps/files_sharing/tests/MountProviderTest.php +++ b/apps/files_sharing/tests/MountProviderTest.php @@ -123,6 +123,12 @@ class MountProviderTest extends \Test\TestCase { $this->makeMockShare(8, 102, 'user2', '/share6', 31), $this->makeMockShare(9, 102, 'user2', '/share6', 31), ]; + $deckShares = [ + $this->makeMockShare(10, 103, 'user2', '/share7', 0), + $this->makeMockShare(11, 103, 'user1', '/share7', 31), + $this->makeMockShare(12, 103, 'user2', '/share7', 31), + $this->makeMockShare(13, 103, 'user2', '/share7', 31), + ]; // tests regarding circles are made in the app itself. $circleShares = []; $this->user->expects($this->any()) @@ -144,16 +150,21 @@ class MountProviderTest extends \Test\TestCase { ->method('getSharedWith') ->with('user1', IShare::TYPE_ROOM, null, -1) ->willReturn($roomShares); + $this->shareManager->expects($this->at(4)) + ->method('getSharedWith') + ->with('user1', IShare::TYPE_DECK, null, -1) + ->willReturn($deckShares); $this->shareManager->expects($this->any()) ->method('newShare') ->willReturnCallback(function () use ($rootFolder, $userManager) { return new \OC\Share20\Share($rootFolder, $userManager); }); $mounts = $this->provider->getMountsForUser($this->user, $this->loader); - $this->assertCount(3, $mounts); + $this->assertCount(4, $mounts); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[0]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[1]); $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[2]); + $this->assertInstanceOf('OCA\Files_Sharing\SharedMount', $mounts[3]); $mountedShare1 = $mounts[0]->getShare(); $this->assertEquals('2', $mountedShare1->getId()); $this->assertEquals('user2', $mountedShare1->getShareOwner()); @@ -172,6 +183,12 @@ class MountProviderTest extends \Test\TestCase { $this->assertEquals(102, $mountedShare3->getNodeId()); $this->assertEquals('/share6', $mountedShare3->getTarget()); $this->assertEquals(31, $mountedShare3->getPermissions()); + $mountedShare4 = $mounts[3]->getShare(); + $this->assertEquals('12', $mountedShare4->getId()); + $this->assertEquals('user2', $mountedShare4->getShareOwner()); + $this->assertEquals(103, $mountedShare4->getNodeId()); + $this->assertEquals('/share7', $mountedShare4->getTarget()); + $this->assertEquals(31, $mountedShare4->getPermissions()); } public function mergeSharesDataProvider() { @@ -337,6 +354,7 @@ class MountProviderTest extends \Test\TestCase { // tests regarding circles are made in the app itself. $circleShares = []; $roomShares = []; + $deckShares = []; $this->shareManager->expects($this->at(0)) ->method('getSharedWith') ->with('user1', IShare::TYPE_USER) @@ -353,6 +371,10 @@ class MountProviderTest extends \Test\TestCase { ->method('getSharedWith') ->with('user1', IShare::TYPE_ROOM, null, -1) ->willReturn($roomShares); + $this->shareManager->expects($this->at(4)) + ->method('getSharedWith') + ->with('user1', IShare::TYPE_DECK, null, -1) + ->willReturn($deckShares); $this->shareManager->expects($this->any()) ->method('newShare') ->willReturnCallback(function () use ($rootFolder, $userManager) { |