diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2016-07-14 20:41:10 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2016-07-14 20:48:45 +0200 |
commit | f8a531c06c8095be4edcbd70063437e67833668e (patch) | |
tree | b98c42b535229d9e72834cdc75adebfc54e2bded /apps/federatedfilesharing/tests | |
parent | c7f6461c53e1d432f268305e63eb9a604e12cba4 (diff) | |
download | nextcloud-server-f8a531c06c8095be4edcbd70063437e67833668e.tar.gz nextcloud-server-f8a531c06c8095be4edcbd70063437e67833668e.zip |
don't convert link share to federated share if outgoing federated shares are forbidden
Diffstat (limited to 'apps/federatedfilesharing/tests')
-rw-r--r-- | apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index 816fc90c4e1..3fe05e72cf4 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -109,13 +109,26 @@ class MountPublicLinkControllerTest extends \Test\TestCase { * @dataProvider dataTestCreateFederatedShare * * @param string $shareWith + * @param bool $outgoingSharesAllowed * @param bool $validShareWith * @param string $token * @param bool $validToken * @param bool $createSuccessful * @param string $expectedReturnData */ - public function testCreateFederatedShare($shareWith, $validShareWith, $token, $validToken, $createSuccessful, $expectedReturnData) { + public function testCreateFederatedShare($shareWith, + $outgoingSharesAllowed, + $validShareWith, + $token, + $validToken, + $createSuccessful, + $expectedReturnData + ) { + + $this->federatedShareProvider->expects($this->any()) + ->method('isOutgoingServer2serverShareEnabled') + ->willReturn($outgoingSharesAllowed); + $this->addressHandler->expects($this->any())->method('splitUserRemote') ->with($shareWith) ->willReturnCallback( @@ -154,7 +167,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase { $result = $this->controller->createFederatedShare($shareWith, $token); - $errorCase = !$validShareWith || !$validToken || !$createSuccessful; + $errorCase = !$validShareWith || !$validToken || !$createSuccessful || !$outgoingSharesAllowed; if ($errorCase) { $this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus()); @@ -171,15 +184,16 @@ class MountPublicLinkControllerTest extends \Test\TestCase { public function dataTestCreateFederatedShare() { return [ - //shareWith, validShareWith, token, validToken, createSuccessful, expectedReturnData - ['user@server', true, 'token', true, true, 'server'], - ['user@server', false, 'token', true, true, 'invalid federated cloud id'], - ['user@server', false, 'token', false, true, 'invalid federated cloud id'], - ['user@server', false, 'token', false, false, 'invalid federated cloud id'], - ['user@server', false, 'token', true, false, 'invalid federated cloud id'], - ['user@server', true, 'token', false, true, 'invalid token'], - ['user@server', true, 'token', false, false, 'invalid token'], - ['user@server', true, 'token', true, false, 'can not create share'] + //shareWith, outgoingSharesAllowed, validShareWith, token, validToken, createSuccessful, expectedReturnData + ['user@server', true, true, 'token', true, true, 'server'], + ['user@server', true, false, 'token', true, true, 'invalid federated cloud id'], + ['user@server', true, false, 'token', false, true, 'invalid federated cloud id'], + ['user@server', true, false, 'token', false, false, 'invalid federated cloud id'], + ['user@server', true, false, 'token', true, false, 'invalid federated cloud id'], + ['user@server', true, true, 'token', false, true, 'invalid token'], + ['user@server', true, true, 'token', false, false, 'invalid token'], + ['user@server', true, true, 'token', true, false, 'can not create share'], + ['user@server', false, true, 'token', true, true, 'This server doesn\'t support outgoing federated shares'], ]; } |