Пример #1
0
 def test_default_feedback_1(self):
     feedback = factories.OptOutFeedbackFactory.create_batch(3, default=True)
     request = RequestFactory().get('/', data={'tag': 'default:1'})
     view = views.OptOutConfirm(request=request)
     form = view.get_form()
     items = list(form.fields['feedback'].queryset)
     self.assertEqual(set(feedback), set(items))
Пример #2
0
 def test_success_url(self):
     view = views.OptOutConfirm()
     view.object = factories.OptOutFactory(pk=1, secret='7ebc5d464a6485e4b64f', email='*****@*****.**')
     url = view.get_success_url()
     self.assertEqual('/opt-out/success/1/7ebc5d464a6485e4b64f/[email protected]', url)
Пример #3
0
 def test_overriden_success_url(self):
     view = views.OptOutConfirm()
     view.object = factories.OptOutFactory(pk=1, secret='7ebc5d464a6485e4b64f', email='*****@*****.**')
     url = view.get_success_url()
     self.assertEqual('/mocked_goodbye/1/7ebc5d464a6485e4b64f/[email protected]/', url)
Пример #4
0
 def test_default_feedback_0(self):
     factories.OptOutFeedbackFactory.create_batch(3, default=True)
     request = RequestFactory().get('/', data={'tag': 'default:0'})
     view = views.OptOutConfirm(request=request)
     form = view.get_form()
     self.assertEqual(0, form.fields['feedback'].queryset.count())