Failing test for #1429

This commit is contained in:
Karl Hobley 2015-07-19 16:51:32 +01:00 committed by Matt Westcott
parent 3062835918
commit 9af51be873

View file

@ -2,6 +2,8 @@
from __future__ import unicode_literals
import json
import unittest
import mock
from django.test import TestCase
from django.core import mail
@ -9,7 +11,7 @@ from django import forms
from django.core.urlresolvers import reverse
from wagtail.wagtailcore.models import Page
from wagtail.wagtailforms.models import FormSubmission
from wagtail.wagtailforms.models import FormSubmission, AbstractForm
from wagtail.wagtailforms.forms import FormBuilder
from wagtail.tests.testapp.models import FormPage, FormField
from wagtail.tests.utils import WagtailTestUtils
@ -64,6 +66,15 @@ class TestFormSubmission(TestCase):
self.assertTemplateUsed(response, 'tests/form_page.html')
self.assertTemplateNotUsed(response, 'tests/form_page_landing.html')
@unittest.expectedFailure
@mock.patch.object(AbstractForm, 'get_context', autospec=True)
def test_get_form_calls_get_context(self, get_context):
get_context.side_effect = Page.get_context
# 1429 - Serving form page should call the get_context method
self.client.get('/contact-us/')
self.assertTrue(get_context.called)
def test_post_invalid_form(self):
response = self.client.post('/contact-us/', {
'your-email': 'bob',