diff options
author | Robin Appelman <robin@icewind.nl> | 2017-01-27 12:52:17 +0100 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-02-08 15:17:02 +0100 |
commit | fa49c4a13b6c5455b13ad44cfc158b271aa9b616 (patch) | |
tree | 1014b6de1bd3761e2e26467c78c6f5fd4697ea56 /apps/federatedfilesharing/tests | |
parent | 1a591cea97313b8500154d6c2c9ce3aaf2f38a88 (diff) | |
download | nextcloud-server-fa49c4a13b6c5455b13ad44cfc158b271aa9b616.tar.gz nextcloud-server-fa49c4a13b6c5455b13ad44cfc158b271aa9b616.zip |
Add a single public api for resolving a cloud id to a user and remote and back
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/federatedfilesharing/tests')
4 files changed, 37 insertions, 6 deletions
diff --git a/apps/federatedfilesharing/tests/AddressHandlerTest.php b/apps/federatedfilesharing/tests/AddressHandlerTest.php index f62f3b62e03..f59855dd4d1 100644 --- a/apps/federatedfilesharing/tests/AddressHandlerTest.php +++ b/apps/federatedfilesharing/tests/AddressHandlerTest.php @@ -25,6 +25,7 @@ namespace OCA\FederatedFileSharing\Tests; +use OC\Federation\CloudIdManager; use OCA\FederatedFileSharing\AddressHandler; use OCP\IL10N; use OCP\IURLGenerator; @@ -40,6 +41,9 @@ class AddressHandlerTest extends \Test\TestCase { /** @var IL10N | \PHPUnit_Framework_MockObject_MockObject */ private $il10n; + /** @var CloudIdManager */ + private $cloudIdManager; + public function setUp() { parent::setUp(); @@ -48,7 +52,9 @@ class AddressHandlerTest extends \Test\TestCase { $this->il10n = $this->getMockBuilder('OCP\IL10N') ->getMock(); - $this->addressHandler = new AddressHandler($this->urlGenerator, $this->il10n); + $this->cloudIdManager = new CloudIdManager(); + + $this->addressHandler = new AddressHandler($this->urlGenerator, $this->il10n, $this->cloudIdManager); } public function dataTestSplitUserRemote() { diff --git a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php index bd091bed410..7714ff4731c 100644 --- a/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/MountPublicLinkControllerTest.php @@ -25,11 +25,13 @@ namespace OCA\FederatedFileSharing\Tests\Controller; +use OC\Federation\CloudIdManager; use OC\HintException; use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\Controller\MountPublicLinkController; use OCA\FederatedFileSharing\FederatedShareProvider; use OCP\AppFramework\Http; +use OCP\Federation\ICloudIdManager; use OCP\Files\IRootFolder; use OCP\Http\Client\IClientService; use OCP\IL10N; @@ -77,6 +79,9 @@ class MountPublicLinkControllerTest extends \Test\TestCase { /** @var IShare */ private $share; + /** @var ICloudIdManager */ + private $cloudIdManager; + public function setUp() { parent::setUp(); @@ -93,6 +98,7 @@ class MountPublicLinkControllerTest extends \Test\TestCase { $this->l10n = $this->getMockBuilder('OCP\IL10N')->disableOriginalConstructor()->getMock(); $this->userSession = $this->getMockBuilder('OCP\IUserSession')->disableOriginalConstructor()->getMock(); $this->clientService = $this->getMockBuilder('OCP\Http\Client\IClientService')->disableOriginalConstructor()->getMock(); + $this->cloudIdManager = new CloudIdManager(); $this->controller = new MountPublicLinkController( 'federatedfilesharing', $this->request, @@ -102,7 +108,8 @@ class MountPublicLinkControllerTest extends \Test\TestCase { $this->session, $this->l10n, $this->userSession, - $this->clientService + $this->clientService, + $this->cloudIdManager ); } diff --git a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php index 18d698d398e..61f87e9ec67 100644 --- a/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php +++ b/apps/federatedfilesharing/tests/Controller/RequestHandlerControllerTest.php @@ -27,10 +27,12 @@ namespace OCA\FederatedFileSharing\Tests; +use OC\Federation\CloudIdManager; use OC\Files\Filesystem; use OCA\FederatedFileSharing\DiscoveryManager; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Controller\RequestHandlerController; +use OCP\Federation\ICloudIdManager; use OCP\Http\Client\IClient; use OCP\Http\Client\IClientService; use OCP\Http\Client\IResponse; @@ -72,6 +74,9 @@ class RequestHandlerControllerTest extends TestCase { /** @var IShare|\PHPUnit_Framework_MockObject_MockObject */ private $share; + /** @var ICloudIdManager */ + private $cloudIdManager; + protected function setUp() { parent::setUp(); @@ -100,6 +105,8 @@ class RequestHandlerControllerTest extends TestCase { $this->addressHandler = $this->getMockBuilder('OCA\FederatedFileSharing\AddressHandler') ->disableOriginalConstructor()->getMock(); $this->userManager = $this->getMockBuilder('OCP\IUserManager')->getMock(); + + $this->cloudIdManager = new CloudIdManager(); $this->registerHttpHelper($httpHelperMock); @@ -111,7 +118,8 @@ class RequestHandlerControllerTest extends TestCase { \OC::$server->getShareManager(), $this->notifications, $this->addressHandler, - $this->userManager + $this->userManager, + $this->cloudIdManager ); $this->connection = \OC::$server->getDatabaseConnection(); @@ -190,7 +198,8 @@ class RequestHandlerControllerTest extends TestCase { \OC::$server->getShareManager(), $this->notifications, $this->addressHandler, - $this->userManager + $this->userManager, + $this->cloudIdManager ] )->setMethods(['executeDeclineShare', 'verifyShare'])->getMock(); diff --git a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php index 874d4b48a5c..97d8ccd65c3 100644 --- a/apps/federatedfilesharing/tests/FederatedShareProviderTest.php +++ b/apps/federatedfilesharing/tests/FederatedShareProviderTest.php @@ -25,10 +25,12 @@ namespace OCA\FederatedFileSharing\Tests; +use OC\Federation\CloudIdManager; use OCA\FederatedFileSharing\AddressHandler; use OCA\FederatedFileSharing\FederatedShareProvider; use OCA\FederatedFileSharing\Notifications; use OCA\FederatedFileSharing\TokenHandler; +use OCP\Federation\ICloudIdManager; use OCP\Files\IRootFolder; use OCP\IConfig; use OCP\IDBConnection; @@ -69,6 +71,9 @@ class FederatedShareProviderTest extends \Test\TestCase { /** @var FederatedShareProvider */ protected $provider; + /** @var ICloudIdManager */ + private $cloudIdManager; + public function setUp() { parent::setUp(); @@ -94,6 +99,8 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->userManager->expects($this->any())->method('userExists')->willReturn(true); + $this->cloudIdManager = new CloudIdManager(); + $this->provider = new FederatedShareProvider( $this->connection, $this->addressHandler, @@ -103,7 +110,8 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->logger, $this->rootFolder, $this->config, - $this->userManager + $this->userManager, + $this->cloudIdManager ); $this->shareManager = \OC::$server->getShareManager(); @@ -400,7 +408,8 @@ class FederatedShareProviderTest extends \Test\TestCase { $this->logger, $this->rootFolder, $this->config, - $this->userManager + $this->userManager, + $this->cloudIdManager ] )->setMethods(['sendPermissionUpdate'])->getMock(); |