Skip to content

Commit

Permalink
Patch class as shared variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Lenc committed Oct 31, 2014
1 parent a336022 commit 974c0a9
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions user_management/api/tests/test_views.py
Expand Up @@ -21,6 +21,7 @@

User = get_user_model()
TEST_SERVER = 'http://testserver'
THROTTLE_RATE_PATH = 'rest_framework.throttling.ScopedRateThrottle.THROTTLE_RATES'


class GetTokenTest(APIRequestTestCase):
Expand Down Expand Up @@ -87,9 +88,7 @@ def test_user_auth_throttle_GET_requests(self):

self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)

@patch('rest_framework.throttling.ScopedRateThrottle.THROTTLE_RATES', new={
'logins': '1/minute',
})
@patch(THROTTLE_RATE_PATH, new={'logins': '1/minute'})
def test_user_auth_throttle_POST_requests(self):
"""Ensure POST requests are throttled correctly."""
data = {
Expand Down Expand Up @@ -231,9 +230,7 @@ def test_existent_email(self):

send_email.assert_called_once_with(user)

@patch('rest_framework.throttling.ScopedRateThrottle.THROTTLE_RATES', new={
'passwords': '1/minute',
})
@patch(THROTTLE_RATE_PATH, new={'passwords': '1/minute'})
def test_post_rate_limit(self):
"""Ensure the POST requests are rate limited."""
email = 'exists@example.com'
Expand Down

0 comments on commit 974c0a9

Please sign in to comment.