summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-11-11 11:35:11 +0100
committerRobin Appelman <robin@icewind.nl>2016-11-16 15:24:31 +0100
commit311531ecce497663960877fc536ba94deff27bc0 (patch)
treeaed13ae42c1c72f47d8c6dff185e291a6a4e6a63 /tests
parent59d6003f898e82f00436aa251502e73f796ac725 (diff)
downloadnextcloud-server-311531ecce497663960877fc536ba94deff27bc0.tar.gz
nextcloud-server-311531ecce497663960877fc536ba94deff27bc0.zip
Adds tests for the AuthSettingsController
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests')
-rw-r--r--tests/Settings/Controller/AuthSettingsControllerTest.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/Settings/Controller/AuthSettingsControllerTest.php b/tests/Settings/Controller/AuthSettingsControllerTest.php
index 339c698bcbb..782c9f644e0 100644
--- a/tests/Settings/Controller/AuthSettingsControllerTest.php
+++ b/tests/Settings/Controller/AuthSettingsControllerTest.php
@@ -42,6 +42,7 @@ class AuthSettingsControllerTest extends TestCase {
/** @var AuthSettingsController */
private $controller;
private $request;
+ /** @var IProvider|\PHPUnit_Framework_MockObject_MockObject */
private $tokenProvider;
private $userManager;
private $session;
@@ -200,4 +201,26 @@ class AuthSettingsControllerTest extends TestCase {
$this->assertEquals([], $this->controller->destroy($id));
}
+ public function testUpdateToken() {
+ $token = $this->createMock(DefaultToken::class);
+
+ $this->tokenProvider->expects($this->once())
+ ->method('getTokenById')
+ ->with($this->equalTo(42))
+ ->willReturn($token);
+
+ $token->expects($this->once())
+ ->method('setScope')
+ ->with($this->equalTo([
+ 'filesystem' => true,
+ 'app' => ['dav', 'myapp']
+ ]));
+
+ $this->tokenProvider->expects($this->once())
+ ->method('updateToken')
+ ->with($this->equalTo($token));
+
+ $this->assertSame([], $this->controller->update(42, ['filesystem' => true, 'apps' => ['dav', 'myapp']]));
+ }
+
}