kopia lustrzana https://github.com/wagtail/wagtail
Added another test for #838
This tests that the page is copied to the different parent when a different parent is selected.pull/845/head
rodzic
dad7621f48
commit
c50b79f8ee
|
@ -1167,6 +1167,22 @@ class TestPageCopy(TestCase, WagtailTestUtils):
|
||||||
self.assertFalse(unpublished_child_copy.live)
|
self.assertFalse(unpublished_child_copy.live)
|
||||||
self.assertTrue(unpublished_child_copy.has_unpublished_changes)
|
self.assertTrue(unpublished_child_copy.has_unpublished_changes)
|
||||||
|
|
||||||
|
def test_page_copy_post_new_parent(self):
|
||||||
|
post_data = {
|
||||||
|
'new_title': "Hello world 2",
|
||||||
|
'new_slug': 'hello-world-2',
|
||||||
|
'new_parent_page': str(self.test_child_page.id),
|
||||||
|
'copy_subpages': False,
|
||||||
|
'publish_copies': False,
|
||||||
|
}
|
||||||
|
response = self.client.post(reverse('wagtailadmin_pages_copy', args=(self.test_page.id, )), post_data)
|
||||||
|
|
||||||
|
# Check that the user was redirected to the new parents explore page
|
||||||
|
self.assertRedirects(response, reverse('wagtailadmin_explore', args=(self.test_child_page.id, )))
|
||||||
|
|
||||||
|
# Check that the page was copied to the correct place
|
||||||
|
self.assertTrue(Page.objects.filter(slug='hello-world-2').first().get_parent(), self.test_child_page)
|
||||||
|
|
||||||
def test_page_copy_post_existing_slug_within_same_parent_page(self):
|
def test_page_copy_post_existing_slug_within_same_parent_page(self):
|
||||||
# This tests the existing slug checking on page copy when not changing the parent page
|
# This tests the existing slug checking on page copy when not changing the parent page
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue