diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-10 16:40:30 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-13 13:58:51 +0300 |
commit | 5df727d4ad3a735d35a5b13502c93791c84fa948 (patch) | |
tree | 9d908ef9fc1f800b03431d16f558daff073cfad0 /apps/federatedfilesharing/tests/FederatedShareProviderTest.php | |
parent | 3c1365c0d12a626e8c2b8e1ab35b105f4b88ad2e (diff) |
Fix federated file sharing
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/federatedfilesharing/tests/FederatedShareProviderTest.php')
-rw-r--r-- | apps/federatedfilesharing/tests/FederatedShareProviderTest.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 7d571b2082c..788ae47fded 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -53,7 +53,7 @@ class FederatedShareProviderTest extends \Test\TestCase { protected $addressHandler; /** @var Notifications | \PHPUnit_Framework_MockObject_MockObject */ protected $notifications; - /** @var TokenHandler */ + /** @var TokenHandler|\PHPUnit_Framework_MockObject_MockObject */ protected $tokenHandler; /** @var IL10N */ protected $l; @@ -798,8 +798,10 @@ class FederatedShareProviderTest extends \Test\TestCase { $folder1 = $rootFolder->getUserFolder($u1->getUID())->newFolder('foo'); $file1 = $folder1->newFile('bar1'); - $this->tokenHandler->method('generateToken')->willReturn('token'); - $this->notifications + $this->tokenHandler->expects($this->exactly(2)) + ->method('generateToken') + ->willReturnOnConsecutiveCalls('token1', 'token2'); + $this->notifications->expects($this->atLeastOnce()) ->method('sendRemoteShare') ->willReturn(true); @@ -811,9 +813,26 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setNode($file1); $this->provider->create($share1); + $share2 = $this->shareManager->newShare(); + $share2->setSharedWith('foobar@localhost') + ->setSharedBy($u1->getUID()) + ->setShareOwner($u1->getUID()) + ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setNode($file1); + $this->provider->create($share2); + $result = $this->provider->getAccessList([$file1], true); - $this->assertSame(['remote' => true], $result); + $this->assertEquals(['remote' => [ + 'user@server.com' => [ + 'token' => 'token1', + 'node_id' => $file1->getId(), + ], + 'foobar@localhost' => [ + 'token' => 'token2', + 'node_id' => $file1->getId(), + ], + ]], $result); $u1->delete(); } } |