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']))
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']))
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']))
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']))
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)