def test_form_validation_for_too_long_titles(self): form = LinkForm(data={'title': 'An unexpected failure—it’s actually in the tests for our final view, view_list. Because we’ve changed the way errors are displayed in all templates, we’re no longer showing the error that we manually pass into the template.', 'url': ''}) self.assertFalse(form.is_valid()) self.assertEqual( form.errors['title'], [TITLE_LENGTH_ERROR] )
def test_form_validation_for_too_long_titles(self): form = LinkForm( data={ 'title': 'An unexpected failure—it’s actually in the tests for our final view, view_list. Because we’ve changed the way errors are displayed in all templates, we’re no longer showing the error that we manually pass into the template.', 'url': '' }) self.assertFalse(form.is_valid()) self.assertEqual(form.errors['title'], [TITLE_LENGTH_ERROR])
def test_form_validation_for_blank_titles_and_urls(self): form = LinkForm(data={'title': '', 'url': ''}) self.assertFalse(form.is_valid()) self.assertEqual( form.errors['title'], [TITLE_EMPTY_ERROR] ) self.assertEqual( form.errors['url'], [URL_EMPTY_ERROR] )
def test_form_validation_for_blank_titles_and_urls(self): form = LinkForm(data={'title': '', 'url': ''}) self.assertFalse(form.is_valid()) self.assertEqual(form.errors['title'], [TITLE_EMPTY_ERROR]) self.assertEqual(form.errors['url'], [URL_EMPTY_ERROR])