summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests
diff options
context:
space:
mode:
authorRobin McCorkell <rmccorkell@owncloud.com>2015-09-23 15:35:17 +0100
committerRobin McCorkell <rmccorkell@owncloud.com>2015-09-23 16:00:11 +0100
commit24043333008b12dfbe7374cb318d9041717b87e0 (patch)
tree415d4ddb64db6da0971d6059769a0ef0e63a815f /apps/files_external/tests
parent6f5f1c4f142e5e2417b188b55d2f9fadf03749b3 (diff)
downloadnextcloud-server-24043333008b12dfbe7374cb318d9041717b87e0.tar.gz
nextcloud-server-24043333008b12dfbe7374cb318d9041717b87e0.zip
Perform visibility checks on storages
StoragesService::getStorages() will check the visibility of the backend and auth mechanism for the storage, and if either are not visible to the user (aka disabled by admin) then the storage will be filtered out. The original method StoragesService::getAllStorages() still exists in case such storages need to be detected, but its use is discouraged.
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r--apps/files_external/tests/controller/globalstoragescontrollertest.php4
-rw-r--r--apps/files_external/tests/controller/userstoragescontrollertest.php3
-rw-r--r--apps/files_external/tests/service/userglobalstoragesservicetest.php4
3 files changed, 11 insertions, 0 deletions
diff --git a/apps/files_external/tests/controller/globalstoragescontrollertest.php b/apps/files_external/tests/controller/globalstoragescontrollertest.php
index e1bfad8caf6..6b020198bd8 100644
--- a/apps/files_external/tests/controller/globalstoragescontrollertest.php
+++ b/apps/files_external/tests/controller/globalstoragescontrollertest.php
@@ -24,6 +24,7 @@ use \OCA\Files_external\Controller\GlobalStoragesController;
use \OCA\Files_external\Service\GlobalStoragesService;
use \OCP\AppFramework\Http;
use \OCA\Files_external\NotFoundException;
+use \OCA\Files_External\Service\BackendService;
class GlobalStoragesControllerTest extends StoragesControllerTest {
public function setUp() {
@@ -32,6 +33,9 @@ class GlobalStoragesControllerTest extends StoragesControllerTest {
->disableOriginalConstructor()
->getMock();
+ $this->service->method('getVisibilityType')
+ ->willReturn(BackendService::VISIBILITY_ADMIN);
+
$this->controller = new GlobalStoragesController(
'files_external',
$this->getMock('\OCP\IRequest'),
diff --git a/apps/files_external/tests/controller/userstoragescontrollertest.php b/apps/files_external/tests/controller/userstoragescontrollertest.php
index 9f1a8df8d2e..33ef274c87c 100644
--- a/apps/files_external/tests/controller/userstoragescontrollertest.php
+++ b/apps/files_external/tests/controller/userstoragescontrollertest.php
@@ -40,6 +40,9 @@ class UserStoragesControllerTest extends StoragesControllerTest {
->disableOriginalConstructor()
->getMock();
+ $this->service->method('getVisibilityType')
+ ->willReturn(BackendService::VISIBILITY_PERSONAL);
+
$this->controller = new UserStoragesController(
'files_external',
$this->getMock('\OCP\IRequest'),
diff --git a/apps/files_external/tests/service/userglobalstoragesservicetest.php b/apps/files_external/tests/service/userglobalstoragesservicetest.php
index 867872f3683..8b4b9b0163e 100644
--- a/apps/files_external/tests/service/userglobalstoragesservicetest.php
+++ b/apps/files_external/tests/service/userglobalstoragesservicetest.php
@@ -209,7 +209,11 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$expectedPrecedence
) {
$backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB');
+ $backend->method('isVisibleFor')
+ ->willReturn(true);
$authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism');
+ $authMechanism->method('isVisibleFor')
+ ->willReturn(true);
$storage1 = new StorageConfig();
$storage1->setMountPoint('mountpoint');