mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-14 02:03:11 +00:00
tests(Django 1.9): Add test for stripping whitespace from title / seo_title
This commit is contained in:
parent
65f97bba6f
commit
abe4eb6f28
1 changed files with 18 additions and 0 deletions
|
|
@ -670,6 +670,24 @@ class TestPageCreation(TestCase, WagtailTestUtils):
|
|||
page = Page.objects.order_by('-id').first()
|
||||
self.assertEqual(page.seo_title, '')
|
||||
|
||||
def test_whitespace_is_stripped_from_titles(self):
|
||||
post_data = {
|
||||
'title': " Hello ",
|
||||
'content': "Some content",
|
||||
'slug': 'hello-world',
|
||||
'action-submit': "Submit",
|
||||
'seo_title': ' hello SEO '
|
||||
}
|
||||
response = self.client.post(reverse('wagtailadmin_pages:add', args=('tests', 'simplepage', self.root_page.id)), post_data)
|
||||
|
||||
# Should be successful, as both title and seo_title are non-empty after stripping
|
||||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
# Whitespace should be automatically stripped from title and seo_title
|
||||
page = Page.objects.order_by('-id').first()
|
||||
self.assertEqual(page.title, 'Hello')
|
||||
self.assertEqual(page.seo_title, 'hello SEO')
|
||||
|
||||
def test_long_slug(self):
|
||||
post_data = {
|
||||
'title': "Hello world",
|
||||
|
|
|
|||
Loading…
Reference in a new issue