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
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-09-12 23:28:43 +0300
committerRoeland Jago Douma <roeland@famdouma.nl>2017-09-12 23:28:43 +0300
commit9163cf924180efb434030ec7c95f417e537c8372 (patch)
treee35054febf147b5d725595f0bb9c3cb888c01bd7 /tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
parent83508d7be3fb9b151c4b73152cf3719d38060d39 (diff)
Fix AppPassword 2FA auth
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/Authentication/TwoFactorAuth/ManagerTest.php')
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index 4fa3b3d7e14..9db27edd70c 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -388,9 +388,13 @@ class ManagerTest extends TestCase {
$user = $this->createMock(IUser::class);
$this->session->expects($this->at(0))
->method('exists')
+ ->with('app_password')
+ ->willReturn(false);
+ $this->session->expects($this->at(1))
+ ->method('exists')
->with('two_factor_auth_uid')
->will($this->returnValue(false));
- $this->session->expects($this->at(1))
+ $this->session->expects($this->at(2))
->method('exists')
->with(Manager::SESSION_UID_DONE)
->willReturn(false);
@@ -523,6 +527,8 @@ class ManagerTest extends TestCase {
->will($this->returnCallback(function($var) {
if ($var === Manager::SESSION_UID_KEY) {
return false;
+ } else if ($var === 'app_password') {
+ return false;
}
return true;
}));
@@ -585,4 +591,13 @@ class ManagerTest extends TestCase {
$this->assertFalse($this->manager->needsSecondFactor($user));
}
+
+ public function testNeedsSecondFactorAppPassword() {
+ $user = $this->createMock(IUser::class);
+ $this->session->method('exists')
+ ->with('app_password')
+ ->willReturn(true);
+
+ $this->assertFalse($this->manager->needsSecondFactor($user));
+ }
}