diff options
Diffstat (limited to 'djangorestframework/tests/throttling.py')
| -rw-r--r-- | djangorestframework/tests/throttling.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/djangorestframework/tests/throttling.py b/djangorestframework/tests/throttling.py index 73a4c02b..8c5457d3 100644 --- a/djangorestframework/tests/throttling.py +++ b/djangorestframework/tests/throttling.py @@ -12,25 +12,28 @@ from djangorestframework.permissions import PerUserThrottling, PerViewThrottling from djangorestframework.resources import FormResource from djangorestframework.response import Response + class MockView(View): - permissions_classes = ( PerUserThrottling, ) + permission_classes = (PerUserThrottling,) throttle = '3/sec' def get(self, request): return Response('foo') + class MockView_PerViewThrottling(MockView): - permissions_classes = ( PerViewThrottling, ) + permission_classes = (PerViewThrottling,) + class MockView_PerResourceThrottling(MockView): - permissions_classes = ( PerResourceThrottling, ) + permission_classes = (PerResourceThrottling,) resource = FormResource + class MockView_MinuteThrottling(MockView): throttle = '3/min' - class ThrottlingTests(TestCase): urls = 'djangorestframework.tests.throttling' @@ -54,7 +57,7 @@ class ThrottlingTests(TestCase): """ Explicitly set the timer, overriding time.time() """ - view.permissions_classes[0].timer = lambda self: value + view.permission_classes[0].timer = lambda self: value def test_request_throttling_expires(self): """ @@ -101,7 +104,6 @@ class ThrottlingTests(TestCase): """ self.ensure_is_throttled(MockView_PerResourceThrottling, 503) - def ensure_response_header_contains_proper_throttle_field(self, view, expected_headers): """ Ensure the response returns an X-Throttle field with status and next attributes |
