def check_permission(self, article, user, access): request = self.factory.get(article.get_absolute_url()) request.user = user if access: self.assertEqual(view_article(request, article.id).status_code, 200) else: with self.assertRaises(Http404): view_article(request, article.id)
def request(self, article, user): request = self.factory.get(article.get_absolute_url()) request.user = user return view_article(request, article.id)