Fix external storagestests

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-11-27 13:47:39 +01:00
parent 734d496d63
commit e3e782b63d
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 18 additions and 12 deletions

View File

@ -252,10 +252,7 @@ abstract class StoragesServiceTest extends \Test\TestCase {
}
public function testNonExistingStorage() {
$this->expectException(\OCA\Files_External\NotFoundException::class);
protected function ActualNonExistingStorageTest() {
$backend = $this->backendService->getBackend('identifier:\OCA\Files_External\Lib\Backend\SMB');
$authMechanism = $this->backendService->getAuthMechanism('identifier:\Auth\Mechanism');
$storage = new StorageConfig(255);
@ -265,6 +262,12 @@ abstract class StoragesServiceTest extends \Test\TestCase {
$this->service->updateStorage($storage);
}
public function testNonExistingStorage() {
$this->expectException(\OCA\Files_External\NotFoundException::class);
$this->ActualNonExistingStorageTest();
}
public function deleteStorageDataProvider() {
return [
// regular case, can properly delete the oc_storages entry
@ -334,11 +337,14 @@ abstract class StoragesServiceTest extends \Test\TestCase {
$this->assertCount($expectedCountAfterDeletion, $storages, "expected $expectedCountAfterDeletion storages, got " . json_encode($storages));
}
protected function actualDeletedUnexistingStorageTest() {
$this->service->removeStorage(255);
}
public function testDeleteUnexistingStorage() {
$this->expectException(\OCA\Files_External\NotFoundException::class);
$this->service->removeStorage(255);
$this->actualDeletedUnexistingStorageTest();
}
public function testCreateStorage() {

View File

@ -158,7 +158,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
}
public function testAddStorage($storageParams = null) {
$this->expectException(\DomainException::class);
@ -174,7 +174,7 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$this->service->addStorage($storage);
}
public function testUpdateStorage($storageParams = null) {
$this->expectException(\DomainException::class);
@ -194,11 +194,11 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$this->service->updateStorage($retrievedStorage);
}
public function testNonExistingStorage() {
$this->expectException(\DomainException::class);
parent::testNonExistingStorage();
$this->ActualNonExistingStorageTest();
}
/**
@ -222,11 +222,11 @@ class UserGlobalStoragesServiceTest extends GlobalStoragesServiceTest {
$this->service->removeStorage($id);
}
public function testDeleteUnexistingStorage() {
$this->expectException(\DomainException::class);
parent::testDeleteUnexistingStorage();
$this->actualDeletedUnexistingStorageTest();
}
public function getUniqueStoragesProvider() {