def setUp(self): """Setup the test""" self.view = views.UnsubscribeView.as_view() self.factory = RequestFactory() self.request = self.factory.get('/') self.email = '*****@*****.**' self.code = hashgen(self.email)
def test_dispatch_non_valid_email(self): """Test that a 404 is returned with a non-valid email""" with self.assertRaises(Http404): self.request.GET = { 'email': 'notanemail', 'code': hashgen('notanemail') } self.view(self.request)