diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-04 10:39:13 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-11 10:11:48 +0200 |
commit | 3942d731d21e6369c395358699a9561519992069 (patch) | |
tree | 0f310ce8856af82c1f279a1e1e6f323cba9f1483 /apps/federatedfilesharing | |
parent | 5b06a7d773d303a9b01c98eb714fd1829129646f (diff) | |
download | nextcloud-server-3942d731d21e6369c395358699a9561519992069.tar.gz nextcloud-server-3942d731d21e6369c395358699a9561519992069.zip |
update unit tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'apps/federatedfilesharing')
-rw-r--r-- | apps/federatedfilesharing/tests/FederatedShareProviderTest.php | 28 | ||||
-rw-r--r-- | apps/federatedfilesharing/tests/Settings/AdminTest.php | 21 |
2 files changed, 46 insertions, 3 deletions
diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 52266383b36..98ad8832fa1 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -33,6 +33,7 @@ use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Notifications; use OCA\FederatedFileSharing\TokenHandler; +use OCP\Federation\ICloudFederationProviderManager; use OCP\Federation\ICloudIdManager; use OCP\Files\File; use OCP\Files\IRootFolder; @@ -80,6 +81,8 @@ class FederatedShareProviderTest extends \Test\TestCase { /** @var ICloudIdManager */ private $cloudIdManager; + /** @var \PHPUnit_Framework_MockObject_MockObject|ICloudFederationProviderManager */ + private $cloudFederationProviderManager; public function setUp() { parent::setUp(); @@ -107,6 +110,8 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->userManager->expects($this->any())->method('userExists')->willReturn(true); + $this->cloudFederationProviderManager = $this->createMock(ICloudFederationProviderManager::class); + $this->provider = new FederatedShareProvider( $this->connection, $this->addressHandler, @@ -118,7 +123,8 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->config, $this->userManager, $this->cloudIdManager, - $this->gsConfig + $this->gsConfig, + $this->cloudFederationProviderManager ); $this->shareManager = \OC::$server->getShareManager(); @@ -141,6 +147,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->tokenHandler->method('generateToken')->willReturn('token'); @@ -212,6 +219,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->tokenHandler->method('generateToken')->willReturn('token'); @@ -268,6 +276,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->tokenHandler->method('generateToken')->willReturn('token'); @@ -367,6 +376,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->tokenHandler->method('generateToken')->willReturn('token'); @@ -417,7 +427,8 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->config, $this->userManager, $this->cloudIdManager, - $this->gsConfig + $this->gsConfig, + $this->cloudFederationProviderManager ] )->setMethods(['sendPermissionUpdate'])->getMock(); @@ -435,6 +446,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy($sharedBy) ->setShareOwner($owner) ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->tokenHandler->method('generateToken')->willReturn('token'); @@ -505,6 +517,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share); @@ -513,6 +526,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy2') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share2); @@ -543,6 +557,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share); @@ -555,6 +570,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node2); $this->provider->create($share2); @@ -584,6 +600,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('shareOwner') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share); @@ -592,6 +609,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share2); @@ -628,6 +646,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share); @@ -636,6 +655,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy('sharedBy') ->setShareOwner('shareOwner') ->setPermissions(19) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($node); $this->provider->create($share2); @@ -826,6 +846,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setShareOwner($u1->getUID()) ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($file1); $this->provider->create($share1); @@ -834,6 +855,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy($u2->getUID()) ->setShareOwner($u1->getUID()) ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($file2); $this->provider->create($share2); @@ -880,6 +902,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setShareOwner($u1->getUID()) ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($file1); $this->provider->create($share1); @@ -888,6 +911,7 @@ class FederatedShareProviderTest extends \Test\TestCase { ->setSharedBy($u1->getUID()) ->setShareOwner($u1->getUID()) ->setPermissions(\OCP\Constants::PERMISSION_READ) + ->setShareType(\OCP\Share::SHARE_TYPE_REMOTE) ->setNode($file1); $this->provider->create($share2); diff --git a/apps/federatedfilesharing/tests/Settings/AdminTest.php b/apps/federatedfilesharing/tests/Settings/AdminTest.php index debd2bec63a..f0cf3b77d38 100644 --- a/apps/federatedfilesharing/tests/Settings/AdminTest.php +++ b/apps/federatedfilesharing/tests/Settings/AdminTest.php @@ -74,12 +74,28 @@ class AdminTest extends TestCase { ->willReturn($state); $this->federatedShareProvider ->expects($this->once()) + ->method('isIncomingServer2serverShareEnabled') + ->willReturn($state); + $this->federatedShareProvider + ->expects($this->once()) ->method('isLookupServerQueriesEnabled') ->willReturn($state); $this->federatedShareProvider ->expects($this->once()) ->method('isLookupServerUploadEnabled') ->willReturn($state); + $this->federatedShareProvider + ->expects($this->once()) + ->method('isFederatedGroupSharingSupported') + ->willReturn($state); + $this->federatedShareProvider + ->expects($this->once()) + ->method('isOutgoingServer2serverGroupShareEnabled') + ->willReturn($state); + $this->federatedShareProvider + ->expects($this->once()) + ->method('isIncomingServer2serverGroupShareEnabled') + ->willReturn($state); $this->gsConfig->expects($this->once())->method('onlyInternalFederation') ->willReturn($state); @@ -88,7 +104,10 @@ class AdminTest extends TestCase { 'outgoingServer2serverShareEnabled' => $state, 'incomingServer2serverShareEnabled' => $state, 'lookupServerEnabled' => $state, - 'lookupServerUploadEnabled' => $state + 'lookupServerUploadEnabled' => $state, + 'federatedGroupSharingSupported' => $state, + 'outgoingServer2serverGroupShareEnabled' => $state, + 'incomingServer2serverGroupShareEnabled' => $state, ]; $expected = new TemplateResponse('federatedfilesharing', 'settings-admin', $params, ''); $this->assertEquals($expected, $this->admin->getForm()); |