Beispiel #1
0
 def test_required(self):
     """ Test that required AUStateFields throw appropriate errors. """
     form = AustralianPlaceForm({'state': 'NSW', 'name': 'Wollongong'})
     self.assertFalse(form.is_valid())
     self.assertEqual(form.errors['state_required'],
                      [u'This field is required.'])
     self.assertEqual(form.errors['postcode_required'],
                      [u'This field is required.'])
Beispiel #2
0
 def setUp(self):
     self.form = AustralianPlaceForm({
         'state': 'WA',
         'state_required': 'QLD',
         'name': 'dummy',
         'postcode': '1234',
         'postcode_required': '4321',
     })
Beispiel #3
0
 def test_default_values(self):
     """ Ensure that default values are selected in forms. """
     form = AustralianPlaceForm()
     self.assertTrue(
         re.search(SELECTED_OPTION_PATTERN % 'NSW',
                   str(form['state_default'])))
     self.assertTrue(
         re.search(INPUT_VALUE_PATTERN % '2500',
                   str(form['postcode_default'])))