Mercurial > public > sg101
comparison accounts/tests/view_tests.py @ 690:988782c6ce6c
For #48, rework blocking code to use fail2ban.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 01 Sep 2013 00:15:42 -0500 |
parents | 8e6b8ffe5f34 |
children |
comparison
equal
deleted
inserted
replaced
689:a8dc08cc5db4 | 690:988782c6ce6c |
---|---|
8 from django.core.urlresolvers import reverse | 8 from django.core.urlresolvers import reverse |
9 from django.core import mail | 9 from django.core import mail |
10 from django.contrib.auth.models import User | 10 from django.contrib.auth.models import User |
11 from django.contrib.auth.hashers import check_password | 11 from django.contrib.auth.hashers import check_password |
12 | 12 |
13 from antispam.rate_limit import unblock_ip | |
14 from accounts.models import PendingUser | 13 from accounts.models import PendingUser |
15 from accounts.models import IllegalUsername | 14 from accounts.models import IllegalUsername |
16 from accounts.models import IllegalEmail | 15 from accounts.models import IllegalEmail |
17 | 16 |
18 | 17 |
33 key='key') | 32 key='key') |
34 | 33 |
35 IllegalUsername.objects.create(username='illegalusername') | 34 IllegalUsername.objects.create(username='illegalusername') |
36 IllegalEmail.objects.create(email='illegal@example.com') | 35 IllegalEmail.objects.create(email='illegal@example.com') |
37 | 36 |
38 def tearDown(self): | |
39 unblock_ip('127.0.0.1') | |
40 | |
41 def test_get_view(self): | 37 def test_get_view(self): |
42 """ | 38 """ |
43 Test a simple get of the registration view | 39 Test a simple get of the registration view |
44 | 40 |
45 """ | 41 """ |
221 'agree_privacy': 'on', | 217 'agree_privacy': 'on', |
222 'question1': '101', | 218 'question1': '101', |
223 'question2': 'non blank', | 219 'question2': 'non blank', |
224 }) | 220 }) |
225 | 221 |
226 self.assertEqual(response.status_code, 403) | 222 self.assertEqual(response.status_code, 200) |
227 | 223 |
228 def test_success(self): | 224 def test_success(self): |
229 """ | 225 """ |
230 Ensure we can successfully register. | 226 Ensure we can successfully register. |
231 | 227 |