diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-07-27 14:14:20 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-07-27 14:17:45 +0200 |
commit | f22ab3e665124e79427f51049fea0f937b66cdbb (patch) | |
tree | a2f4b3260853d0252b76d3ce452512a3f6a47ee6 /tests/lib | |
parent | 63aa12e38c2e819b54c4b9e9632264a0e59dc6f2 (diff) | |
download | nextcloud-server-f22ab3e665124e79427f51049fea0f937b66cdbb.tar.gz nextcloud-server-f22ab3e665124e79427f51049fea0f937b66cdbb.zip |
Add metadata to \OCP\AppFramework\Http\Response::throttle
Fixes https://github.com/nextcloud/server/issues/5891
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests/lib')
-rw-r--r-- | tests/lib/AppFramework/Http/ResponseTest.php | 5 | ||||
-rw-r--r-- | tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/tests/lib/AppFramework/Http/ResponseTest.php b/tests/lib/AppFramework/Http/ResponseTest.php index d8959face89..9267d862600 100644 --- a/tests/lib/AppFramework/Http/ResponseTest.php +++ b/tests/lib/AppFramework/Http/ResponseTest.php @@ -269,4 +269,9 @@ class ResponseTest extends \Test\TestCase { $this->childResponse->throttle(); $this->assertTrue($this->childResponse->isThrottled()); } + + public function testGetThrottleMetadata() { + $this->childResponse->throttle(['foo' => 'bar']); + $this->assertSame(['foo' => 'bar'], $this->childResponse->getThrottleMetadata()); + } } diff --git a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php index 14d3b796846..ae2345764ff 100644 --- a/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php +++ b/tests/lib/AppFramework/Middleware/Security/BruteForceMiddlewareTest.php @@ -112,6 +112,10 @@ class BruteForceMiddlewareTest extends TestCase { ->expects($this->once()) ->method('isThrottled') ->willReturn(true); + $response + ->expects($this->once()) + ->method('getThrottleMetadata') + ->willReturn([]); $this->reflector ->expects($this->once()) ->method('getAnnotationParameter') |