Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-03-05 14:19:20 +0300
committerJulius Härtl <jus@bitgrid.net>2018-03-05 14:19:20 +0300
commit723b8764d111fd414cf2e37ae06e0b9a29c9dff7 (patch)
tree56d532655a7fe1785cec336c81eed03b41256848 /tests/Core
parent3ced2c7ab25ae6c7f64d96a4b16754f902a9689f (diff)
Add ETag to NavigationController
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/NavigationControllerTest.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Core/Controller/NavigationControllerTest.php b/tests/Core/Controller/NavigationControllerTest.php
index 1143ed003f0..ef4720604fb 100644
--- a/tests/Core/Controller/NavigationControllerTest.php
+++ b/tests/Core/Controller/NavigationControllerTest.php
@@ -23,6 +23,7 @@
namespace Tests\Core\Controller;
use OC\Core\Controller\NavigationController;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\INavigationManager;
use OCP\IRequest;
@@ -126,4 +127,34 @@ class NavigationControllerTest extends TestCase {
}
}
+ public function testGetAppNavigationEtagMatch() {
+ $navigation = [ ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ];
+ $this->request->expects($this->once())
+ ->method('getHeader')
+ ->with('If-None-Match')
+ ->willReturn(md5(json_encode($navigation)));
+ $this->navigationManager->expects($this->once())
+ ->method('getAll')
+ ->with('link')
+ ->willReturn($navigation);
+ $actual = $this->controller->getAppsNavigation();
+ $this->assertInstanceOf(DataResponse::class, $actual);
+ $this->assertEquals(Http::STATUS_NOT_MODIFIED, $actual->getStatus());
+ }
+
+ public function testGetSettingsNavigationEtagMatch() {
+ $navigation = [ ['id' => 'files', 'href' => '/index.php/apps/files', 'icon' => 'icon' ] ];
+ $this->request->expects($this->once())
+ ->method('getHeader')
+ ->with('If-None-Match')
+ ->willReturn(md5(json_encode($navigation)));
+ $this->navigationManager->expects($this->once())
+ ->method('getAll')
+ ->with('settings')
+ ->willReturn($navigation);
+ $actual = $this->controller->getSettingsNavigation();
+ $this->assertInstanceOf(DataResponse::class, $actual);
+ $this->assertEquals(Http::STATUS_NOT_MODIFIED, $actual->getStatus());
+ }
+
}