コード例 #1
0
ファイル: tests.py プロジェクト: CodeTag/taximetracker
    def test_al_hacer_get_en_enlace_de_todas_las_tareas_muestra_esas_tareas(self):

        user = User.objects.create(username="******", password="******")

        project = ProjectFactory()

        t1 = TaskFactory(user=user, project=project)
        t1.start()
        t1.stop()

        other_month = datetime.now() - timedelta(days=32)

        t2 = TaskFactory(user=user,project=project)
        t2.current_timer = TimerFactory(task=t2, initial_time=other_month)
        t2.stop()

        t3 = TaskFactory(user=user,project=project)
        t3.current_timer = TimerFactory(task=t3, initial_time=other_month, final_time=other_month)

        factory = RequestFactory()
        request = factory.get("/yourtasks/")
        request.user = user
        result = yourtasks(request)
        self.assertIn(t1.name,result.content)
        self.assertIn(t2.name,result.content)
        self.assertIn(t3.name,result.content)
        self.assertEqual(result.status_code,200)