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
path: root/tests
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-02-01 19:34:03 +0300
committerLukas Reschke <lukas@owncloud.com>2015-02-01 19:34:03 +0300
commitba29ea178f7ba18795e36b55ba8b397703280792 (patch)
treefc39058572a7765fa09a0f35bda2c972d92e8ceb /tests
parent35afb0d22e41c195ba8ac4a7dc942ba4b0b97d42 (diff)
Add unit tests for empty token
Diffstat (limited to 'tests')
-rw-r--r--tests/core/lostpassword/controller/lostcontrollertest.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/core/lostpassword/controller/lostcontrollertest.php b/tests/core/lostpassword/controller/lostcontrollertest.php
index 2ed7692a32f..3f3cda2b0c7 100644
--- a/tests/core/lostpassword/controller/lostcontrollertest.php
+++ b/tests/core/lostpassword/controller/lostcontrollertest.php
@@ -159,7 +159,7 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
$this->container['Config']
->expects($this->once())
->method('getUserValue')
- ->with('InvalidTokenUser', 'owncloud', 'lostpassword')
+ ->with('InvalidTokenUser', 'owncloud', 'lostpassword', null)
->will($this->returnValue('TheOnlyAndOnlyOneTokenToResetThePassword'));
// With an invalid token
@@ -178,7 +178,7 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
$this->container['Config']
->expects($this->once())
->method('getUserValue')
- ->with('ValidTokenUser', 'owncloud', 'lostpassword')
+ ->with('ValidTokenUser', 'owncloud', 'lostpassword', null)
->will($this->returnValue('TheOnlyAndOnlyOneTokenToResetThePassword'));
$user = $this->getMockBuilder('\OCP\IUser')
->disableOriginalConstructor()->getMock();
@@ -200,4 +200,17 @@ class LostControllerTest extends \PHPUnit_Framework_TestCase {
$expectedResponse = array('status' => 'success');
$this->assertSame($expectedResponse, $response);
}
+
+ public function testIsSetPasswordWithoutTokenFailing() {
+ $this->container['Config']
+ ->expects($this->once())
+ ->method('getUserValue')
+ ->with('ValidTokenUser', 'owncloud', 'lostpassword', null)
+ ->will($this->returnValue(null));
+
+ $response = $this->lostController->setPassword('', 'ValidTokenUser', 'NewPassword', true);
+ $expectedResponse = ['status' => 'error', 'msg' => ''];
+ $this->assertSame($expectedResponse, $response);
+ }
+
}