diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2021-09-06 17:46:02 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2021-09-06 17:46:02 +0200 |
commit | 6337bb3f59e7e47e20d634bd9b92e6e4b14cfe1c (patch) | |
tree | 4fc4e7e374b0f7ac79edf7296d4b5419f2fb99d6 /tests | |
parent | 5600c7b43fba3a71f0426932ade6737758665311 (diff) | |
download | nextcloud-server-6337bb3f59e7e47e20d634bd9b92e6e4b14cfe1c.tar.gz nextcloud-server-6337bb3f59e7e47e20d634bd9b92e6e4b14cfe1c.zip |
Adjust tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php | 12 | ||||
-rw-r--r-- | tests/lib/Security/RateLimiting/LimiterTest.php | 16 |
2 files changed, 12 insertions, 16 deletions
diff --git a/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php b/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php index 8bbf88e8a8e..e7cb4a93a29 100644 --- a/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php +++ b/tests/lib/Security/RateLimiting/Backend/MemoryCacheBackendTest.php @@ -82,9 +82,9 @@ class MemoryCacheBackendTest extends TestCase { '1', '2', '87', - '123', - '123', - '124', + '223', + '223', + '224', ])); $this->assertSame(3, $this->memoryCache->getAttempts('Method', 'User')); @@ -106,7 +106,7 @@ class MemoryCacheBackendTest extends TestCase { ->method('set') ->with( 'eea460b8d756885099c7f0a4c083bf6a745069ee4a301984e726df58fd4510bffa2dac4b7fd5d835726a6753ffa8343ba31c7e902bbef78fc68c2e743667cb4b', - json_encode(['123']) + json_encode(['223']) ); $this->memoryCache->registerAttempt('Method', 'User', 100); @@ -116,7 +116,7 @@ class MemoryCacheBackendTest extends TestCase { $this->timeFactory ->expects($this->once()) ->method('getTime') - ->willReturn(129); + ->willReturn(86); $this->cache ->expects($this->once()) @@ -140,7 +140,7 @@ class MemoryCacheBackendTest extends TestCase { '123', '123', '124', - '129', + '186', ]) ); diff --git a/tests/lib/Security/RateLimiting/LimiterTest.php b/tests/lib/Security/RateLimiting/LimiterTest.php index 31c877cbda3..a5b187fb546 100644 --- a/tests/lib/Security/RateLimiting/LimiterTest.php +++ b/tests/lib/Security/RateLimiting/LimiterTest.php @@ -55,8 +55,7 @@ class LimiterTest extends TestCase { ->method('getAttempts') ->with( 'MyIdentifier', - '4664f0d9c88dcb7552be47b37bb52ce35977b2e60e1ac13757cf625f31f87050a41f3da064887fa87d49fd042e4c8eb20de8f10464877d3959677ab011b73a47', - 100 + '4664f0d9c88dcb7552be47b37bb52ce35977b2e60e1ac13757cf625f31f87050a41f3da064887fa87d49fd042e4c8eb20de8f10464877d3959677ab011b73a47' ) ->willReturn(101); @@ -69,8 +68,7 @@ class LimiterTest extends TestCase { ->method('getAttempts') ->with( 'MyIdentifier', - '4664f0d9c88dcb7552be47b37bb52ce35977b2e60e1ac13757cf625f31f87050a41f3da064887fa87d49fd042e4c8eb20de8f10464877d3959677ab011b73a47', - 100 + '4664f0d9c88dcb7552be47b37bb52ce35977b2e60e1ac13757cf625f31f87050a41f3da064887fa87d49fd042e4c8eb20de8f10464877d3959677ab011b73a47' ) ->willReturn(99); $this->backend @@ -79,7 +77,7 @@ class LimiterTest extends TestCase { ->with( 'MyIdentifier', '4664f0d9c88dcb7552be47b37bb52ce35977b2e60e1ac13757cf625f31f87050a41f3da064887fa87d49fd042e4c8eb20de8f10464877d3959677ab011b73a47', - 2000 + 100 ); $this->limiter->registerAnonRequest('MyIdentifier', 100, 100, '127.0.0.1'); @@ -101,8 +99,7 @@ class LimiterTest extends TestCase { ->method('getAttempts') ->with( 'MyIdentifier', - 'ddb2ec50fa973fd49ecf3d816f677c8095143e944ad10485f30fb3dac85c13a346dace4dae2d0a15af91867320957bfd38a43d9eefbb74fe6919e15119b6d805', - 100 + 'ddb2ec50fa973fd49ecf3d816f677c8095143e944ad10485f30fb3dac85c13a346dace4dae2d0a15af91867320957bfd38a43d9eefbb74fe6919e15119b6d805' ) ->willReturn(101); @@ -122,8 +119,7 @@ class LimiterTest extends TestCase { ->method('getAttempts') ->with( 'MyIdentifier', - 'ddb2ec50fa973fd49ecf3d816f677c8095143e944ad10485f30fb3dac85c13a346dace4dae2d0a15af91867320957bfd38a43d9eefbb74fe6919e15119b6d805', - 100 + 'ddb2ec50fa973fd49ecf3d816f677c8095143e944ad10485f30fb3dac85c13a346dace4dae2d0a15af91867320957bfd38a43d9eefbb74fe6919e15119b6d805' ) ->willReturn(99); $this->backend @@ -132,7 +128,7 @@ class LimiterTest extends TestCase { ->with( 'MyIdentifier', 'ddb2ec50fa973fd49ecf3d816f677c8095143e944ad10485f30fb3dac85c13a346dace4dae2d0a15af91867320957bfd38a43d9eefbb74fe6919e15119b6d805', - 2000 + 100 ); $this->limiter->registerUserRequest('MyIdentifier', 100, 100, $user); |