示例#1
0
 def test_contact_form_post_valid(self):
     """ Test posting valid data
     :return: None
     """
     data = data_contact()
     response = self.client.post(reverse('ninecms:contact'), data, follow=True)
     self.assertContains(response, get_front_title() + '</h1>')
     self.assertContains(response, "A message has been sent to the site using the contact form.")
     self.assertRedirects(response, reverse(data['redirect']))
示例#2
0
 def test_contact_form_post_invalid(self):
     """ Test posting invalid data
     :return: None
     """
     data = data_contact()
     del data['sender_name']
     response = self.client.post(reverse('ninecms:contact'), data, follow=True)
     self.assertContains(response, get_front_title() + '</h1>')
     self.assertContains(response, "Contact form message has NOT been sent. Please fill in all contact form fields.")
     self.assertRedirects(response, reverse(data['redirect']))
示例#3
0
 def test_contact_form_post_valid(self):
     """ Test posting valid data
     :return: None
     """
     data = data_contact()
     response = self.client.post(reverse('ninecms:contact'),
                                 data,
                                 follow=True)
     self.assertContains(response, get_front_title() + '</h1>')
     self.assertContains(
         response,
         "A message has been sent to the site using the contact form.")
     self.assertRedirects(response, reverse(data['redirect']))
示例#4
0
 def test_contact_form_post_invalid(self):
     """ Test posting invalid data
     :return: None
     """
     data = data_contact()
     del data['sender_name']
     response = self.client.post(reverse('ninecms:contact'),
                                 data,
                                 follow=True)
     self.assertContains(response, get_front_title() + '</h1>')
     self.assertContains(
         response,
         "Contact form message has NOT been sent. Please fill in all contact form fields."
     )
     self.assertRedirects(response, reverse(data['redirect']))
示例#5
0
 def test_contact_form_valid(self):
     """ Test that a form is valid
     :return: None
     """
     form = ContactForm(data=data_contact())
     self.assertEqual(form.is_valid(), True)
示例#6
0
 def test_contact_form_valid(self):
     """ Test that a form is valid
     :return: None
     """
     form = ContactForm(data=data_contact())
     self.assertEqual(form.is_valid(), True)