|
|
@ -49,15 +49,21 @@ class UserStoragesControllerTest extends StoragesControllerTest { |
|
|
|
} |
|
|
|
|
|
|
|
public function testAddOrUpdateStorageDisallowedBackend() { |
|
|
|
$backend = $this->getBackendMock(); |
|
|
|
$backend->method('isPermitted') |
|
|
|
$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) |
|
|
|
->willReturn(false); |
|
|
|
$authMech = $this->getAuthMechMock(); |
|
|
|
|
|
|
|
$storageConfig = new StorageConfig(1); |
|
|
|
$storageConfig->setMountPoint('mount'); |
|
|
|
$storageConfig->setBackend($backend); |
|
|
|
$storageConfig->setBackend($backend1); |
|
|
|
$storageConfig->setAuthMechanism($authMech); |
|
|
|
$storageConfig->setBackendOptions([]); |
|
|
|
|
|
|
@ -82,6 +88,8 @@ class UserStoragesControllerTest extends StoragesControllerTest { |
|
|
|
|
|
|
|
$this->assertEquals(Http::STATUS_UNPROCESSABLE_ENTITY, $response->getStatus()); |
|
|
|
|
|
|
|
$storageConfig->setBackend($backend2); |
|
|
|
|
|
|
|
$response = $this->controller->update( |
|
|
|
1, |
|
|
|
'mount', |
|
|
|