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:
authorJulius Härtl <jus@bitgrid.net>2020-04-21 11:54:22 +0300
committerJulius Härtl <jus@bitgrid.net>2020-04-23 20:12:54 +0300
commit2eadf9d567379e04a0dd8b483e6fe7e3e926716b (patch)
tree7826b8d2751ec430278f0643d85d520d6482c03e /tests/lib/Authentication
parent84330f1d36e885c60135a8a7a5874048c33ed4b4 (diff)
Do not create remember me cookie
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'tests/lib/Authentication')
-rw-r--r--tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
index 98df129771a..7b461219456 100644
--- a/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
+++ b/tests/lib/Authentication/Login/FinishRememberedLoginCommandTest.php
@@ -27,20 +27,25 @@ namespace lib\Authentication\Login;
use OC\Authentication\Login\FinishRememberedLoginCommand;
use OC\User\Session;
+use OCP\IConfig;
use PHPUnit\Framework\MockObject\MockObject;
class FinishRememberedLoginCommandTest extends ALoginCommandTest {
/** @var Session|MockObject */
private $userSession;
+ /** @var IConfig|MockObject */
+ private $config;
protected function setUp(): void {
parent::setUp();
$this->userSession = $this->createMock(Session::class);
+ $this->config = $this->createMock(IConfig::class);
$this->cmd = new FinishRememberedLoginCommand(
- $this->userSession
+ $this->userSession,
+ $this->config
);
}
@@ -57,6 +62,10 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
public function testProcess() {
$data = $this->getLoggedInLoginData();
+ $this->config->expects($this->once())
+ ->method('getSystemValue')
+ ->with('auto_logout', false)
+ ->willReturn(false);
$this->userSession->expects($this->once())
->method('createRememberMeToken')
->with($this->user);
@@ -65,4 +74,18 @@ class FinishRememberedLoginCommandTest extends ALoginCommandTest {
$this->assertTrue($result->isSuccess());
}
+
+ public function testProcessNotRemeberedLoginWithAutologout() {
+ $data = $this->getLoggedInLoginData();
+ $this->config->expects($this->once())
+ ->method('getSystemValue')
+ ->with('auto_logout', false)
+ ->willReturn(true);
+ $this->userSession->expects($this->never())
+ ->method('createRememberMeToken');
+
+ $result = $this->cmd->process($data);
+
+ $this->assertTrue($result->isSuccess());
+ }
}