diff options
Diffstat (limited to 'apps/files_external/tests/Controller/StoragesControllerTest.php')
-rw-r--r-- | apps/files_external/tests/Controller/StoragesControllerTest.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php index 7dc2d287b43..bb9be2f2d4a 100644 --- a/apps/files_external/tests/Controller/StoragesControllerTest.php +++ b/apps/files_external/tests/Controller/StoragesControllerTest.php @@ -130,6 +130,36 @@ abstract class StoragesControllerTest extends \Test\TestCase { $this->assertEquals($storageConfig, $data); } + public function testAddLocalStorageWhenDisabled() { + $authMech = $this->getAuthMechMock(); + $backend = $this->getBackendMock(); + + $storageConfig = new StorageConfig(1); + $storageConfig->setMountPoint('mount'); + $storageConfig->setBackend($backend); + $storageConfig->setAuthMechanism($authMech); + $storageConfig->setBackendOptions([]); + + $this->service->expects($this->never()) + ->method('createStorage'); + $this->service->expects($this->never()) + ->method('addStorage'); + + $response = $this->controller->create( + 'mount', + 'local', + '\OCA\Files_External\Lib\Auth\NullMechanism', + [], + [], + [], + [], + null + ); + + $data = $response->getData(); + $this->assertEquals(Http::STATUS_FORBIDDEN, $response->getStatus()); + } + public function testUpdateStorage() { $authMech = $this->getAuthMechMock(); $authMech->method('validateStorage') |