Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Etienne committed Jan 26, 2015
1 parent 5ec447a commit d5a63b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions user_management/api/serializers.py
Expand Up @@ -175,11 +175,11 @@ def validate_email(self, attrs, source):
try:
self.user = User.objects.get_by_natural_key(email)
except User.DoesNotExist:
msg = _('User does not exists.')
msg = _('A user with this email address does not exist.')
raise serializers.ValidationError(msg)

if not self.user.email_verification_required:
msg = _('User is already confirmed.')
msg = _('User email address is already verified.')
raise serializers.ValidationError(msg)
return attrs

Expand Down
24 changes: 9 additions & 15 deletions user_management/api/tests/test_throttling.py
Expand Up @@ -11,17 +11,19 @@
THROTTLE_RATE_PATH = 'rest_framework.throttling.ScopedRateThrottle.THROTTLE_RATES'


class GetAuthTokenTest(APIRequestTestCase):
class ClearCacheMixin:
def tearDown(self):
# DRF puts a successful (not throttled) request into a cache
cache.clear()


class GetAuthTokenTest(ClearCacheMixin, APIRequestTestCase):
throttle_expected_status = status.HTTP_429_TOO_MANY_REQUESTS
view_class = views.GetAuthToken

def setUp(self):
self.auth_url = reverse('user_management_api:auth')

def tearDown(self):
# DRF puts a successful (not throttled) request onto a cache
cache.clear()

@patch(THROTTLE_RATE_PATH, new={'logins': '1/minute'})
def test_user_auth_throttle(self):
"""Ensure POST requests are throttled correctly."""
Expand Down Expand Up @@ -73,13 +75,9 @@ def test_user_auth_throttle_username(self):
self.assertEqual(response.status_code, self.throttle_expected_status)


class TestPasswordResetEmail(APIRequestTestCase):
class TestPasswordResetEmail(ClearCacheMixin, APIRequestTestCase):
view_class = views.PasswordResetEmail

def tearDown(self):
# DRF puts a successful (not throttled) request onto a cache
cache.clear()

@patch(THROTTLE_RATE_PATH, new={'passwords': '1/minute'})
def test_post_rate_limit(self):
"""Ensure the POST requests are rate limited."""
Expand All @@ -98,13 +96,9 @@ def test_post_rate_limit(self):
self.assertEqual(response.status_code, status.HTTP_429_TOO_MANY_REQUESTS)


class TestResendConfirmationEmail(APIRequestTestCase):
class TestResendConfirmationEmail(ClearCacheMixin, APIRequestTestCase):
view_class = views.ResendConfirmationEmail

def tearDown(self):
# DRF puts a successful (not throttled) request onto a cache
cache.clear()

@patch(THROTTLE_RATE_PATH, new={'confirmations': '1/minute'})
def test_post_rate_limit(self):
"""Assert POST requests are rate limited."""
Expand Down

0 comments on commit d5a63b6

Please sign in to comment.