summaryrefslogtreecommitdiffstats
path: root/apps/files_external/tests
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-01-08 16:14:44 +0100
committerRobin Appelman <robin@icewind.nl>2021-01-08 16:14:44 +0100
commit79b142cd121170663b894e5fc4a32fe50aa33152 (patch)
treefedb8199267e2bed9bf6a01c88411ba79315cc1a /apps/files_external/tests
parent518e91b0087058f2c9813da6a2427a56fc14e32c (diff)
downloadnextcloud-server-79b142cd121170663b894e5fc4a32fe50aa33152.tar.gz
nextcloud-server-79b142cd121170663b894e5fc4a32fe50aa33152.zip
adjust tests
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/tests')
-rw-r--r--apps/files_external/tests/Controller/GlobalStoragesControllerTest.php12
-rw-r--r--apps/files_external/tests/Controller/StoragesControllerTest.php4
-rw-r--r--apps/files_external/tests/Controller/UserStoragesControllerTest.php12
3 files changed, 24 insertions, 4 deletions
diff --git a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
index b2e0a656836..9314488aa08 100644
--- a/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
@@ -26,11 +26,15 @@
namespace OCA\Files_External\Tests\Controller;
+use OC\User\User;
use OCA\Files_External\Controller\GlobalStoragesController;
use OCA\Files_External\Service\BackendService;
+use OCP\IGroupManager;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
+use OCP\IUserSession;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class GlobalStoragesControllerTest extends StoragesControllerTest {
protected function setUp(): void {
@@ -42,12 +46,18 @@ class GlobalStoragesControllerTest extends StoragesControllerTest {
$this->service->method('getVisibilityType')
->willReturn(BackendService::VISIBILITY_ADMIN);
+ $session = $this->createMock(IUserSession::class);
+ $session->method('getUser')
+ ->willReturn(new User('test', null, $this->createMock(EventDispatcherInterface::class)));
+
$this->controller = new GlobalStoragesController(
'files_external',
$this->createMock(IRequest::class),
$this->createMock(IL10N::class),
$this->service,
- $this->createMock(ILogger::class)
+ $this->createMock(ILogger::class),
+ $session,
+ $this->createMock(IGroupManager::class),
);
}
}
diff --git a/apps/files_external/tests/Controller/StoragesControllerTest.php b/apps/files_external/tests/Controller/StoragesControllerTest.php
index fffac01507a..80dd01d3684 100644
--- a/apps/files_external/tests/Controller/StoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/StoragesControllerTest.php
@@ -338,7 +338,9 @@ abstract class StoragesControllerTest extends \Test\TestCase {
$response = $this->controller->show(1);
$this->assertEquals(Http::STATUS_OK, $response->getStatus());
- $this->assertEquals($storageConfig, $response->getData());
+ $expected = $storageConfig->jsonSerialize();
+ $expected['can_edit'] = false;
+ $this->assertEquals($expected, $response->getData());
}
public function validateStorageProvider() {
diff --git a/apps/files_external/tests/Controller/UserStoragesControllerTest.php b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
index ed2d46b6149..7ceb18b633b 100644
--- a/apps/files_external/tests/Controller/UserStoragesControllerTest.php
+++ b/apps/files_external/tests/Controller/UserStoragesControllerTest.php
@@ -27,14 +27,17 @@
namespace OCA\Files_External\Tests\Controller;
+use OC\User\User;
use OCA\Files_External\Controller\UserStoragesController;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\BackendService;
use OCP\AppFramework\Http;
+use OCP\IGroupManager;
use OCP\IL10N;
use OCP\ILogger;
use OCP\IRequest;
use OCP\IUserSession;
+use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class UserStoragesControllerTest extends StoragesControllerTest {
@@ -52,13 +55,18 @@ class UserStoragesControllerTest extends StoragesControllerTest {
$this->service->method('getVisibilityType')
->willReturn(BackendService::VISIBILITY_PERSONAL);
+ $session = $this->createMock(IUserSession::class);
+ $session->method('getUser')
+ ->willReturn(new User('test', null, $this->createMock(EventDispatcherInterface::class)));
+
$this->controller = new UserStoragesController(
'files_external',
$this->createMock(IRequest::class),
$this->createMock(IL10N::class),
$this->service,
- $this->createMock(IUserSession::class),
- $this->createMock(ILogger::class)
+ $this->createMock(ILogger::class),
+ $session,
+ $this->createMock(IGroupManager::class)
);
}