diff options
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'); + } } |