]> source.dussan.org Git - nextcloud-server.git/commitdiff
adjust tests 24661/head
authorRobin Appelman <robin@icewind.nl>
Fri, 8 Jan 2021 15:14:44 +0000 (16:14 +0100)
committerRobin Appelman <robin@icewind.nl>
Fri, 8 Jan 2021 15:14:44 +0000 (16:14 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_external/tests/Controller/GlobalStoragesControllerTest.php
apps/files_external/tests/Controller/StoragesControllerTest.php
apps/files_external/tests/Controller/UserStoragesControllerTest.php

index b2e0a6568364a60cfd952139adef7932c043206c..9314488aa08d17751fa10e40a420d147a526bfde 100644 (file)
 
 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),
                );
        }
 }
index fffac01507aa2653463e28f4a6de9ec683bc9743..80dd01d36842ed95f7d2d52d756bdf353d42b47c 100644 (file)
@@ -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() {
index ed2d46b61499355428499c8a3afe632336829415..7ceb18b633b1fa56e038ad86f00464fef7ba3da9 100644 (file)
 
 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)
                );
        }