Revision a661dfb2
b/snf-astakos-app/astakos/im/tests/auth.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
1 | 2 |
# Copyright 2011 GRNET S.A. All rights reserved. |
2 | 3 |
# |
3 | 4 |
# Redistribution and use in source and binary forms, with or |
... | ... | |
368 | 369 |
settings.ASTAKOS_MODERATION_ENABLED = self._orig_moderation |
369 | 370 |
AstakosUser.objects.all().delete() |
370 | 371 |
|
372 |
@im_settings(RECAPTCHA_ENABLED=True, RATELIMIT_RETRIES_ALLOWED=3) |
|
373 |
def test_login_ratelimit(self): |
|
374 |
credentials = {'username': 'γιού τι έφ', 'password': 'password'} |
|
375 |
r = self.client.post(ui_url('local'), credentials, follow=True) |
|
376 |
fields = r.context['login_form'].fields.keyOrder |
|
377 |
self.assertFalse('recaptcha_challenge_field' in fields) |
|
378 |
r = self.client.post(ui_url('local'), credentials, follow=True) |
|
379 |
fields = r.context['login_form'].fields.keyOrder |
|
380 |
self.assertFalse('recaptcha_challenge_field' in fields) |
|
381 |
r = self.client.post(ui_url('local'), credentials, follow=True) |
|
382 |
fields = r.context['login_form'].fields.keyOrder |
|
383 |
self.assertTrue('recaptcha_challenge_field' in fields) |
|
384 |
|
|
371 | 385 |
def test_no_moderation(self): |
372 | 386 |
# disable moderation |
373 | 387 |
astakos_settings.MODERATION_ENABLED = False |
Also available in: Unified diff