Exemplo n.º 1
0
 def test_tasks_view_no_auth(self):
     """
         Response status must be 302.
     """
     request = self.factory.get(reverse('taskmng:tasks'))
     request.user = AnonymousUser()
     response = tasks(request)
     self.assertEqual(response.status_code, 302)
Exemplo n.º 2
0
    def test_tasks_view(self):
        """
            Response status must be 200.
            Show page only for authorized users.
            Page must have logout button
        """

        # Show page only for authorized users
        request = self.factory.get(reverse('taskmng:tasks'))
        request.user = self.user
        response = tasks(request)
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, '/logout/?next=/')