diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-07-12 13:04:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-12 13:04:54 +0200 |
commit | 86a496d94ae438ae5de033fd6d9c5bee19ed4fcf (patch) | |
tree | 6e732e1beb26840b6345c48495c129eab173d8d0 /tests/Core | |
parent | 08d3cb9107ef800112cc131dfd41b0dd6c43f1f7 (diff) | |
parent | 44d39d87c015e039fc0ed4fd4ad0668899676233 (diff) | |
download | nextcloud-server-86a496d94ae438ae5de033fd6d9c5bee19ed4fcf.tar.gz nextcloud-server-86a496d94ae438ae5de033fd6d9c5bee19ed4fcf.zip |
Merge pull request #5567 from nextcloud/public-capabilities
Public capabilities API
Diffstat (limited to 'tests/Core')
-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( |