Mercurial > public > sg101
comparison bio/tests/form_tests.py @ 612:5be850a66dfc
For BB issue 17, validate timezone values when saving user profiles.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 12 Aug 2012 09:34:56 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
611:8b9fc7487222 | 612:5be850a66dfc |
---|---|
1 """ | |
2 Form tests for the bio application. | |
3 | |
4 """ | |
5 from django.test import TestCase | |
6 | |
7 from bio.forms import EditUserProfileForm | |
8 | |
9 | |
10 class EditUserProfileFormTestCase(TestCase): | |
11 | |
12 def test_valid_timezone(self): | |
13 | |
14 post_data = {'time_zone': 'US/Central'} | |
15 form = EditUserProfileForm(post_data) | |
16 self.assertTrue(form.is_valid()) | |
17 | |
18 def test_invalid_timezone(self): | |
19 | |
20 post_data = {'time_zone': u'Am\xe9rica/Argentina_/_Buenos_Aires'} | |
21 form = EditUserProfileForm(post_data) | |
22 self.assertFalse(form.is_valid()) | |
23 | |
24 def test_blank_timezone(self): | |
25 | |
26 form = EditUserProfileForm({}) | |
27 self.assertTrue(form.is_valid()) | |
28 |