Beispiel #1
0
 def test_update_person_form_not_sure_no_party_no_constituency(self):
     form = UpdatePersonForm(
         {
             'name': 'John Doe',
             'source': 'Just testing...',
             'standing_2015': 'not-sure',
         },
         initial={
             'person': self.person,
         })
     self.assertTrue(form.is_valid())
Beispiel #2
0
 def test_update_person_form_not_sure_party_and_gb_constituency(self):
     form = UpdatePersonForm(
         {
             'name': 'John Doe',
             'source': 'Just testing...',
             'standing_2015': 'not-sure',
             'constituency_2015': '65808',
             'party_gb_2015': self.conservative_party_extra.base.id,
         },
         initial={
             'person': self.person,
         })
     self.assertTrue(form.is_valid())
Beispiel #3
0
 def test_update_person_form_standing_no_party_but_gb_constituency(self):
     form = UpdatePersonForm(
         {
             'name': 'John Doe',
             'source': 'Just testing...',
             'standing_2015': 'standing',
             'constituency_2015': '65808',
         },
         initial={
             'person': self.person,
         })
     self.assertFalse(form.is_valid())
     self.assertEqual(form.errors, {
         '__all__':
         ['You must specify a party for the 2015 General Election']
     })
Beispiel #4
0
 def test_update_person_form_standing_no_party_no_constituency(self):
     form = UpdatePersonForm(
         {
             'name': 'John Doe',
             'source': 'Just testing...',
             'standing_2015': 'standing',
         },
         initial={
             'person': self.person,
         })
     self.assertFalse(form.is_valid())
     self.assertEqual(
         form.errors, {
             '__all__': [
                 'If you mark the candidate as standing in the 2015 General Election, you must select a post'
             ]
         })