def test_unsubscribe_twice(self): self.create_prefs() request = self.request_factory.get("dummy") request.user = AnonymousUser() unsubscribe(request, self.tokens[self.user]) response = unsubscribe(request, self.tokens[self.user]) self.assertEqual(response.status_code, 200) self.assertNotPrefExists(self.user)
def test_user(user): request = self.request_factory.get("dummy") request.user = AnonymousUser() response = unsubscribe(request, self.tokens[user]) self.assertEqual(response.status_code, 200) self.assertNotPrefExists(user)
def test_unsubscribe_post(self): request = self.request_factory.post("dummy") response = unsubscribe(request, "dummy") self.assertEqual(response.status_code, 405)