Esempio n. 1
0
 def test_010_040_test_Form_Invalid_Email(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'email',
             'email': 'a.b.com'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['email'], [u'Enter a valid email address.'])
Esempio n. 2
0
 def test_010_028_test_Form_Pref_No_Data(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'telephone'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['__all__'], [
         u'You must provide at least an email address, telephone number or mobile phone number'
     ])
Esempio n. 3
0
 def test_010_025_test_Form_Invalid_Pref(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'xxx'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['communication_preference'], [
         u'Select a valid choice. xxx is not one of the available choices.'
     ])
Esempio n. 4
0
 def test_010_020_test_Form_No_Pref(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': ''
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(
         f.errors['communication_preference'],
         [u'You must select your preferred communication method'])
Esempio n. 5
0
 def test_010_033_test_Form_No_Email(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'email',
             'mobile': '11111111111'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['__all__'], [
         u"'email' selected as your preferred contact method, but email address not provided"
     ])
Esempio n. 6
0
 def test_010_032_test_Form_No_Telephone(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'telephone',
             'mobile': '11111111111'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['__all__'], [
         u"'telephone' selected as your preferred contact method, but telephone number not provided"
     ])
Esempio n. 7
0
 def test_010_041_test_Form_Invalid_Phone(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'telephone',
             'telephone': '999999'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['telephone'], [
         u'Full phone number must be entered - 11 digits only, no spaces or punctuation.'
     ])
Esempio n. 8
0
 def test_010_041_test_Form_Invalid_Mobile(self):
     f = forms.Communications(
         data={
             'opportunity': self.opp1.id,
             'contact_name': 'Me',
             'communication_preference': 'mobile',
             'mobile': '999999'
         })
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(f.errors['mobile'], [
         u'Mobile number must be entered in digits only - 11 digits only, no spaces.'
     ])
Esempio n. 9
0
 def test_010_010_test_FormNameMandatory(self):
     f = forms.Communications(data={'opportunity': self.opp1.id})
     self.assertEqual(f.is_valid(), False)
     self.assertEqual(
         f.errors['company_name'],
         [u"You must provide either a 'Company Name' or 'Contact Name'"])