From 4b2b49b2fea73beaf05a67d29e4222b945cbdf2f Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Tue, 7 Jan 2020 00:35:32 +0100 Subject: [PATCH] Adjust expected outcome message from Settings form (previous was from SubscriptionForm) --- tests/plugins/notifications/test_views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/plugins/notifications/test_views.py b/tests/plugins/notifications/test_views.py index a5a7b99b..26787869 100644 --- a/tests/plugins/notifications/test_views.py +++ b/tests/plugins/notifications/test_views.py @@ -29,6 +29,7 @@ class NotificationSettingsTests(RequireRootArticleMixin, ArticleWebTestUtils, Dj # management form information, needed because of the formset management_form = response.context['form'].management_form + for i in 'TOTAL_FORMS', 'INITIAL_FORMS', 'MIN_NUM_FORMS', 'MAX_NUM_FORMS': data['%s-%s' % (management_form.prefix, i)] = management_form[i].value() @@ -45,11 +46,13 @@ class NotificationSettingsTests(RequireRootArticleMixin, ArticleWebTestUtils, Dj data['form-0-email'] = 2 data['form-0-interval'] = 0 # post the request without any change + response = self.client.post(url, data, follow=True) self.assertEqual(len(response.context.get('messages')), 1) + message = response.context.get('messages')._loaded_messages[0] - self.assertIn(message.message, 'Your notification settings were unchanged') + self.assertIn(message.message, 'You will receive notifications instantly for 0 articles') # Ensure we didn't create redundant Settings objects assert self.superuser1.nyt_settings.all().count() == 1 -- 2.45.2