diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-02 11:50:41 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-10-02 19:50:54 +0200 |
commit | 19f84f7b5485e204014671d0439e8af5693acbb1 (patch) | |
tree | a386a3212106ceab6c07a98ee4a320f8b0012f37 /tests/lib/Authentication/Token/DefaultTokenProviderTest.php | |
parent | d9febae5b2cbe2147c892030ca9d1b5db7304e9f (diff) | |
download | nextcloud-server-19f84f7b5485e204014671d0439e8af5693acbb1.tar.gz nextcloud-server-19f84f7b5485e204014671d0439e8af5693acbb1.zip |
Add tests
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'tests/lib/Authentication/Token/DefaultTokenProviderTest.php')
-rw-r--r-- | tests/lib/Authentication/Token/DefaultTokenProviderTest.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php index 3fb11f410ba..8b005bd8bdb 100644 --- a/tests/lib/Authentication/Token/DefaultTokenProviderTest.php +++ b/tests/lib/Authentication/Token/DefaultTokenProviderTest.php @@ -28,6 +28,7 @@ use OC\Authentication\Token\DefaultTokenMapper; use OC\Authentication\Token\DefaultTokenProvider; use OC\Authentication\Token\ExpiredTokenException; use OC\Authentication\Token\IToken; +use OC\Authentication\Token\PublicKeyToken; use OCP\AppFramework\Db\DoesNotExistException; use OCP\AppFramework\Utility\ITimeFactory; use OCP\IConfig; @@ -532,4 +533,22 @@ class DefaultTokenProviderTest extends TestCase { $this->tokenProvider->rotate($token, 'oldtoken', 'newtoken'); } + + public function testMarkPasswordInvalidInvalidToken() { + $token = $this->createMock(PublicKeyToken::class); + + $this->expectException(InvalidTokenException::class); + + $this->tokenProvider->markPasswordInvalid($token, 'tokenId'); + } + + public function testMarkPasswordInvalid() { + $token = $this->createMock(DefaultToken::class); + + $this->mapper->expects($this->once()) + ->method('invalidate') + ->with('0c7db0098fe8ddba6032b22719ec18867c69a1820fa36d71c28bf96d52843bdc44a112bd24093b049be5bb54769bcb72d67190a4a9690e51aac263cba38186fb'); + + $this->tokenProvider->markPasswordInvalid($token, 'tokenId'); + } } |