annotate bio/tests/form_tests.py @ 715:820e57e621e8

Use |safe filter on Haystack templates to get better results w/quotes. Content was getting escaped, so text with quotes around it was seemingly missing from the search index. This change fixed that. I verified that the search results will not leak raw HTML to the page so this should be safe to do.
author Brian Neal <bgneal@gmail.com>
date Tue, 17 Sep 2013 20:26:49 -0500
parents 5be850a66dfc
children
rev   line source
bgneal@612 1 """
bgneal@612 2 Form tests for the bio application.
bgneal@612 3
bgneal@612 4 """
bgneal@612 5 from django.test import TestCase
bgneal@612 6
bgneal@612 7 from bio.forms import EditUserProfileForm
bgneal@612 8
bgneal@612 9
bgneal@612 10 class EditUserProfileFormTestCase(TestCase):
bgneal@612 11
bgneal@612 12 def test_valid_timezone(self):
bgneal@612 13
bgneal@612 14 post_data = {'time_zone': 'US/Central'}
bgneal@612 15 form = EditUserProfileForm(post_data)
bgneal@612 16 self.assertTrue(form.is_valid())
bgneal@612 17
bgneal@612 18 def test_invalid_timezone(self):
bgneal@612 19
bgneal@612 20 post_data = {'time_zone': u'Am\xe9rica/Argentina_/_Buenos_Aires'}
bgneal@612 21 form = EditUserProfileForm(post_data)
bgneal@612 22 self.assertFalse(form.is_valid())
bgneal@612 23
bgneal@612 24 def test_blank_timezone(self):
bgneal@612 25
bgneal@612 26 form = EditUserProfileForm({})
bgneal@612 27 self.assertTrue(form.is_valid())
bgneal@612 28