Correctly test for the presence of the message

pull/5138/head
Casper 2019-03-14 09:28:47 +01:00
rodzic 4434887b18
commit a3deeab12c
1 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -2627,10 +2627,11 @@ class TestPageMove(TestCase, WagtailTestUtils):
self.assertEqual(response.status_code, 302)
response = self.client.get(reverse('wagtailadmin_home'))
for message in response.context['messages']:
# Slug should be in error message.
self.assertIn("{}".format(self.test_page_b.slug), message.message)
self.assertEqual(message.level, message_constants.ERROR)
messages = list(response.context['messages'])
self.assertEqual(len(messages), 1)
self.assertEqual(messages[0].level, message_constants.ERROR)
# Slug should be in error message.
self.assertIn("{}".format(self.test_page_b.slug), messages[0].message)
def test_page_set_page_position(self):
response = self.client.get(reverse('wagtailadmin_pages:set_page_position', args=(self.test_page_a.id, )))