diff options
author | Julius Härtl <jus@bitgrid.net> | 2017-06-30 11:21:15 +0200 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-06-30 11:21:15 +0200 |
commit | 01093604d30b1639f5e23a7be408bc7d387e39ef (patch) | |
tree | 7e3d41bc45c59251a6ee502a770f21b204b93bf8 /tests/Core/Controller | |
parent | 42d9be4529cdb56997c2e37273b765677b2af7f5 (diff) | |
download | nextcloud-server-01093604d30b1639f5e23a7be408bc7d387e39ef.tar.gz nextcloud-server-01093604d30b1639f5e23a7be408bc7d387e39ef.zip |
Add tests for public capabilties
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/Core/Controller')
-rw-r--r-- | tests/Core/Controller/OCSControllerTest.php | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/Core/Controller/OCSControllerTest.php b/tests/Core/Controller/OCSControllerTest.php index e6066a80142..9d0a3dae118 100644 --- a/tests/Core/Controller/OCSControllerTest.php +++ b/tests/Core/Controller/OCSControllerTest.php @@ -85,6 +85,9 @@ class OCSControllerTest extends TestCase { } public function testGetCapabilities() { + $this->userSession->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(true); list($major, $minor, $micro) = \OCP\Util::getVersion(); $result = []; @@ -112,6 +115,38 @@ class OCSControllerTest extends TestCase { $this->assertEquals($expected, $this->controller->getCapabilities()); } + public function testGetCapabilitiesPublic() { + $this->userSession->expects($this->once()) + ->method('isLoggedIn') + ->willReturn(false); + list($major, $minor, $micro) = \OCP\Util::getVersion(); + + $result = []; + $result['version'] = array( + 'major' => $major, + 'minor' => $minor, + 'micro' => $micro, + 'string' => \OC_Util::getVersionString(), + 'edition' => '', + ); + + $capabilities = [ + 'foo' => 'bar', + 'a' => [ + 'b' => true, + 'c' => 11, + ] + ]; + $this->capabilitiesManager->method('getCapabilities') + ->with(true) + ->willReturn($capabilities); + + $result['capabilities'] = $capabilities; + + $expected = new DataResponse($result); + $this->assertEquals($expected, $this->controller->getCapabilities()); + } + public function testPersonCheckValid() { $this->userManager->method('checkPassword') ->with( |