summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-09-23 16:03:02 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-09-23 16:03:02 +0200
commit6f5f1c4f142e5e2417b188b55d2f9fadf03749b3 (patch)
tree9ae4dd52814c661fa7449cc81b89cf7d7d30b34d /apps/files_external/tests
parent1c052d554bd09a7d14117971b21e69092f7a1416 (diff)
parent634c1c497c51f00ba5512dae69dfffaf6cf0e3e1 (diff)
downloadnextcloud-server-6f5f1c4f142e5e2417b188b55d2f9fadf03749b3.tar.gz
nextcloud-server-6f5f1c4f142e5e2417b188b55d2f9fadf03749b3.zip
Merge pull request #19139 from owncloud/ext-revert-permissions
Improve deprecated external storage backend handling
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r--apps/files_external/tests/controller/storagescontrollertest.php16
-rw-r--r--apps/files_external/tests/controller/userstoragescontrollertest.php16
-rw-r--r--apps/files_external/tests/service/backendservicetest.php6
3 files changed, 15 insertions, 23 deletions
diff --git a/apps/files_external/tests/controller/storagescontrollertest.php b/apps/files_external/tests/controller/storagescontrollertest.php
index c43761f3bcb..5e1deb821f4 100644
--- a/apps/files_external/tests/controller/storagescontrollertest.php
+++ b/apps/files_external/tests/controller/storagescontrollertest.php
@@ -75,12 +75,12 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$authMech = $this->getAuthMechMock();
$authMech->method('validateStorage')
->willReturn(true);
- $authMech->method('isPermitted')
+ $authMech->method('isVisibleFor')
->willReturn(true);
$backend = $this->getBackendMock();
$backend->method('validateStorage')
->willReturn(true);
- $backend->method('isPermitted')
+ $backend->method('isVisibleFor')
->willReturn(true);
$storageConfig = new StorageConfig(1);
@@ -116,12 +116,12 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$authMech = $this->getAuthMechMock();
$authMech->method('validateStorage')
->willReturn(true);
- $authMech->method('isPermitted')
+ $authMech->method('isVisibleFor')
->willReturn(true);
$backend = $this->getBackendMock();
$backend->method('validateStorage')
->willReturn(true);
- $backend->method('isPermitted')
+ $backend->method('isVisibleFor')
->willReturn(true);
$storageConfig = new StorageConfig(1);
@@ -249,12 +249,12 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$authMech = $this->getAuthMechMock();
$authMech->method('validateStorage')
->willReturn(true);
- $authMech->method('isPermitted')
+ $authMech->method('isVisibleFor')
->willReturn(true);
$backend = $this->getBackendMock();
$backend->method('validateStorage')
->willReturn(true);
- $backend->method('isPermitted')
+ $backend->method('isVisibleFor')
->willReturn(true);
$storageConfig = new StorageConfig(255);
@@ -338,13 +338,13 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$backend = $this->getBackendMock();
$backend->method('validateStorage')
->willReturn($backendValidate);
- $backend->method('isPermitted')
+ $backend->method('isVisibleFor')
->willReturn(true);
$authMech = $this->getAuthMechMock();
$authMech->method('validateStorage')
->will($this->returnValue($authMechValidate));
- $authMech->method('isPermitted')
+ $authMech->method('isVisibleFor')
->willReturn(true);
$storageConfig = new StorageConfig();
diff --git a/apps/files_external/tests/controller/userstoragescontrollertest.php b/apps/files_external/tests/controller/userstoragescontrollertest.php
index b61174b0797..9f1a8df8d2e 100644
--- a/apps/files_external/tests/controller/userstoragescontrollertest.php
+++ b/apps/files_external/tests/controller/userstoragescontrollertest.php
@@ -49,21 +49,15 @@ class UserStoragesControllerTest extends StoragesControllerTest {
}
public function testAddOrUpdateStorageDisallowedBackend() {
- $backend1 = $this->getBackendMock();
- $backend1->expects($this->once())
- ->method('isPermitted')
- ->with(BackendService::USER_PERSONAL, BackendService::PERMISSION_CREATE)
- ->willReturn(false);
- $backend2 = $this->getBackendMock();
- $backend2->expects($this->once())
- ->method('isPermitted')
- ->with(BackendService::USER_PERSONAL, BackendService::PERMISSION_MODIFY)
+ $backend = $this->getBackendMock();
+ $backend->method('isVisibleFor')
+ ->with(BackendService::VISIBILITY_PERSONAL)
->willReturn(false);
$authMech = $this->getAuthMechMock();
$storageConfig = new StorageConfig(1);
$storageConfig->setMountPoint('mount');
- $storageConfig->setBackend($backend1);
+ $storageConfig->setBackend($backend);
$storageConfig->setAuthMechanism($authMech);
$storageConfig->setBackendOptions([]);
@@ -88,8 +82,6 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus());
- $storageConfig->setBackend($backend2);
-
$response = $this->controller->update(
1,
'mount',
diff --git a/apps/files_external/tests/service/backendservicetest.php b/apps/files_external/tests/service/backendservicetest.php
index b37b5e9b466..414a9eee2ec 100644
--- a/apps/files_external/tests/service/backendservicetest.php
+++ b/apps/files_external/tests/service/backendservicetest.php
@@ -83,11 +83,11 @@ class BackendServiceTest extends \Test\TestCase {
$backendAllowed = $this->getBackendMock('\User\Mount\Allowed');
$backendAllowed->expects($this->never())
- ->method('removePermission');
+ ->method('removeVisibility');
$backendNotAllowed = $this->getBackendMock('\User\Mount\NotAllowed');
$backendNotAllowed->expects($this->once())
- ->method('removePermission')
- ->with(BackendService::USER_PERSONAL, BackendService::PERMISSION_CREATE | BackendService::PERMISSION_MOUNT);
+ ->method('removeVisibility')
+ ->with(BackendService::VISIBILITY_PERSONAL);
$backendAlias = $this->getMockBuilder('\OCA\Files_External\Lib\Backend\Backend')
->disableOriginalConstructor()