Commit f08ee8d8 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

astakos: Test ratelimit/recaptcha functionality

parent ea2e6d93
# -*- coding: utf-8 -*-
# Copyright 2011 GRNET S.A. All rights reserved.
#
# Redistribution and use in source and binary forms, with or
......@@ -368,6 +369,19 @@ class TestLocal(TestCase):
settings.ASTAKOS_MODERATION_ENABLED = self._orig_moderation
AstakosUser.objects.all().delete()
@im_settings(RECAPTCHA_ENABLED=True, RATELIMIT_RETRIES_ALLOWED=3)
def test_login_ratelimit(self):
credentials = {'username': 'γιού τι έφ', 'password': 'password'}
r = self.client.post(ui_url('local'), credentials, follow=True)
fields = r.context['login_form'].fields.keyOrder
self.assertFalse('recaptcha_challenge_field' in fields)
r = self.client.post(ui_url('local'), credentials, follow=True)
fields = r.context['login_form'].fields.keyOrder
self.assertFalse('recaptcha_challenge_field' in fields)
r = self.client.post(ui_url('local'), credentials, follow=True)
fields = r.context['login_form'].fields.keyOrder
self.assertTrue('recaptcha_challenge_field' in fields)
def test_no_moderation(self):
# disable moderation
astakos_settings.MODERATION_ENABLED = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment