Пример #1
0
 def test_add_new_team(self):
     """
         Add new team instance
     """
     request = self.factory.post(reverse('taskmng:team'),
                                 {"add_team": 1, "name": "My team"})
     request.user = self.user
     team(request)
     self.assertEqual(Team.objects.count(), 1)
Пример #2
0
 def test_team_view_no_auth(self):
     """
         Response status must be 302.
     """
     request = self.factory.get(reverse('taskmng:team'))
     request.user = AnonymousUser()
     response = team(request)
     self.assertEqual(response.status_code, 302)
Пример #3
0
    def test_tasks_view(self):
        """
            Response status must be 200.
            Show page only for authorized users.
            Page must have tags for angular apps
        """

        # Show page only for authorized users
        request = self.factory.get(reverse('taskmng:team'))
        request.user = self.user
        response = team(request)
        self.assertEqual(response.status_code, 200)
        self.assertContains(response, '<team-manage></team-manage>')
        self.assertContains(response, '<invite-friends></invite-friends>')