Failing test for unschedule for unpublished pages

pull/4669/merge
Abdulmalik Abdulwahab 2018-07-03 10:05:09 +01:00 zatwierdzone przez Matt Westcott
rodzic c22321ee75
commit e616d11bdc
1 zmienionych plików z 42 dodań i 0 usunięć

Wyświetl plik

@ -4244,6 +4244,48 @@ class TestRevisionsUnschedule(TestCase, WagtailTestUtils):
self.assertIsNone(self.christmas_event.revisions.get(id=self.this_christmas_revision.id).approved_go_live_at)
class TestRevisionsUnscheduleForUnpublishedPages(TestCase, WagtailTestUtils):
fixtures = ['test.json']
def setUp(self):
self.unpublished_event = EventPage.objects.get(url_path='/home/events/tentative-unpublished-event/')
self.unpublished_event.title = "Unpublished Page"
self.unpublished_event.date_from = '2014-12-25'
self.unpublished_event.body = (
"<p>Some Content</p>"
)
self.unpublished_revision = self.unpublished_event.save_revision()
self.unpublished_revision.created_at = local_datetime(2014, 12, 25)
self.unpublished_revision.save()
self.user = self.login()
def test_unschedule_view(self):
"""
This tests that the unschedule view responds with a confirm page
"""
response = self.client.get(reverse('wagtailadmin_pages:revisions_unschedule', args=(self.unpublished_event.id, self.unpublished_revision.id)))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtailadmin/pages/revisions/confirm_unschedule.html')
def test_unschedule_view_post(self):
"""
This posts to the unschedule view and checks that the revision was unscheduled
"""
# Post to the unschedule page
response = self.client.post(reverse('wagtailadmin_pages:revisions_unschedule', args=(self.unpublished_event.id, self.unpublished_revision.id)))
# Should be redirected to revisions index page
self.assertRedirects(response, reverse('wagtailadmin_pages:revisions_index', args=(self.unpublished_event.id, )))
# Check that the page has no approved_schedule
self.assertFalse(EventPage.objects.get(id=self.unpublished_event.id).approved_schedule)
# Check that the approved_go_live_at has been cleared from the revision
self.assertIsNone(self.unpublished_event.revisions.get(id=self.unpublished_revision.id).approved_go_live_at)
class TestIssue2599(TestCase, WagtailTestUtils):
"""
When previewing a page on creation, we need to assign it a path value consistent with its