diff options
author | Christoph Wurst <christoph@owncloud.com> | 2016-05-31 10:48:14 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@owncloud.com> | 2016-05-31 17:07:49 +0200 |
commit | c58d8159d7bdee93a67a917e16b750fe99df9f99 (patch) | |
tree | 568acfd8c2f26bd675a151bb42130a626468633b /tests/lib/User | |
parent | 9a9c1b9439055fc6ad9f8372b354e4fc7ce3bc02 (diff) | |
download | nextcloud-server-c58d8159d7bdee93a67a917e16b750fe99df9f99.tar.gz nextcloud-server-c58d8159d7bdee93a67a917e16b750fe99df9f99.zip |
Create session tokens for apache auth users
Diffstat (limited to 'tests/lib/User')
-rw-r--r-- | tests/lib/User/SessionTest.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/lib/User/SessionTest.php b/tests/lib/User/SessionTest.php index 5ff2a16acb9..36f14e85492 100644 --- a/tests/lib/User/SessionTest.php +++ b/tests/lib/User/SessionTest.php @@ -621,4 +621,42 @@ class SessionTest extends \Test\TestCase { $this->invokePrivate($userSession, 'validateSession', [$user]); } + public function testValidateSessionNoPassword() { + $userManager = $this->getMock('\OCP\IUserManager'); + $session = $this->getMock('\OCP\ISession'); + $timeFactory = $this->getMock('\OCP\AppFramework\Utility\ITimeFactory'); + $tokenProvider = $this->getMock('\OC\Authentication\Token\IProvider'); + $userSession = $this->getMockBuilder('\OC\User\Session') + ->setConstructorArgs([$userManager, $session, $timeFactory, $tokenProvider, $this->config]) + ->setMethods(['logout']) + ->getMock(); + + $user = $this->getMock('\OCP\IUser'); + $token = $this->getMock('\OC\Authentication\Token\IToken'); + + $session->expects($this->once()) + ->method('getId') + ->will($this->returnValue('sessionid')); + $tokenProvider->expects($this->once()) + ->method('getToken') + ->with('sessionid') + ->will($this->returnValue($token)); + $session->expects($this->once()) + ->method('get') + ->with('last_login_check') + ->will($this->returnValue(1000)); + $timeFactory->expects($this->once()) + ->method('getTime') + ->will($this->returnValue(5000)); + $tokenProvider->expects($this->once()) + ->method('getPassword') + ->with($token, 'sessionid') + ->will($this->throwException(new \OC\Authentication\Exceptions\PasswordlessTokenException())); + $session->expects($this->once()) + ->method('set') + ->with('last_login_check', 5000); + + $this->invokePrivate($userSession, 'validateSession', [$user]); + } + } |