summaryrefslogtreecommitdiffstats
path: root/tests/Core
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2019-08-18 23:27:03 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2019-08-18 23:27:03 +0200
commit9c4c5ee8187f169d4d915b9bc84988cca2f6619d (patch)
treee2843c511fe7d084b621f37a538763e8c1895b21 /tests/Core
parent7f7c6e49b6df1e1131fb79abc936cce402150618 (diff)
downloadnextcloud-server-9c4c5ee8187f169d4d915b9bc84988cca2f6619d.tar.gz
nextcloud-server-9c4c5ee8187f169d4d915b9bc84988cca2f6619d.zip
Add test case for existing user with token null
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'tests/Core')
-rw-r--r--tests/Core/Controller/LostControllerTest.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 6012341c952..60b96a39081 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -699,6 +699,22 @@ class LostControllerTest extends \Test\TestCase {
$this->assertSame($expectedResponse, $response);
}
+ public function testIsSetPasswordTokenNullFailing() {
+ $this->config->method('getUserValue')
+ ->with('ValidTokenUser', 'core', 'lostpassword', null)
+ ->willReturn(null);
+ $this->userManager->method('get')
+ ->with('ValidTokenUser')
+ ->willReturn($this->existingUser);
+
+ $response = $this->lostController->setPassword('', 'ValidTokenUser', 'NewPassword', true);
+ $expectedResponse = [
+ 'status' => 'error',
+ 'msg' => 'Couldn\'t reset password because the token is invalid'
+ ];
+ $this->assertSame($expectedResponse, $response);
+ }
+
public function testSetPasswordForDisabledUser() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())