Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 def request(self, article, user):
     request = self.factory.get(article.get_absolute_url())
     request.user = user
     return view_article(request, article.id)