aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Security
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-04-12 23:00:02 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-04-13 12:00:18 +0200
commite39e6d0605421faaaec57b3deba1ac2a1805d22e (patch)
tree70e9b4a0de2bdf2b53da9038b9f13e510b974314 /tests/lib/Security
parent31ae39c5690b3d69226fdd5e02b7efd72f8fb9d2 (diff)
downloadnextcloud-server-e39e6d0605421faaaec57b3deba1ac2a1805d22e.tar.gz
nextcloud-server-e39e6d0605421faaaec57b3deba1ac2a1805d22e.zip
Remove expired attempts
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests/lib/Security')
-rw-r--r--tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
index f00d734661d..34c326e72e1 100644
--- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
+++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheTest.php
@@ -88,6 +88,11 @@ class MemoryCacheTest extends TestCase {
}
public function testRegisterAttemptWithNoAttemptsBefore() {
+ $this->timeFactory
+ ->expects($this->once())
+ ->method('getTime')
+ ->willReturn(123);
+
$this->cache
->expects($this->once())
->method('get')
@@ -101,10 +106,15 @@ class MemoryCacheTest extends TestCase {
json_encode(['123'])
);
- $this->memoryCache->registerAttempt('Method', 'User', 123);
+ $this->memoryCache->registerAttempt('Method', 'User', 100);
}
- public function testRegisterAttempts() {
+ public function testRegisterAttempt() {
+ $this->timeFactory
+ ->expects($this->once())
+ ->method('getTime')
+ ->willReturn(129);
+
$this->cache
->expects($this->once())
->method('get')
@@ -123,8 +133,6 @@ class MemoryCacheTest extends TestCase {
->with(
'eea460b8d756885099c7f0a4c083bf6a745069ee4a301984e726df58fd4510bffa2dac4b7fd5d835726a6753ffa8343ba31c7e902bbef78fc68c2e743667cb4b',
json_encode([
- '1',
- '2',
'87',
'123',
'123',
@@ -133,6 +141,6 @@ class MemoryCacheTest extends TestCase {
])
);
- $this->memoryCache->registerAttempt('Method', 'User', 129);
+ $this->memoryCache->registerAttempt('Method', 'User', 100);
}
}