def test_post_data(self): """EmailList.post() gathers post form data.""" request = self.factory.post(self.url) view = setup_view(EmailLink(), request, self.post_data) resp = view.post(request) self.assertTrue('ok' in resp.content)
def test_email_view(self, mock_send_mail, mock_get_template): request = self.factory.post(self.url, data=self.post_data) view = EmailLink.as_view() response = view(request) self.assertTrue(mock_send_mail.call_count == 1) self.assertTrue(mock_get_template.call_count == 1)