Beispiel #1
0
    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)
Beispiel #2
0
    def test_al_hacer_post_para_detener_una_tarea(self):
        user= User.objects.create(username="******",password="******")
        factory = RequestFactory()
        request = factory.post("/yourtasks")
        
        t = TaskFactory(user=user, started=True)
        t.start()

        request.user = user
        request.POST["task_selected"] = t.id
        request.POST["choisebuttom"] = "Stop"
        yourtasks(request)
        tasks_stopped = Task.objects.filter(started=False).count()
        self.assertEqual(tasks_stopped,1)
Beispiel #3
0
    def test_al_detener_tarea_con_campo_de_proyecto_vacio_para_no_detener_tarea_ni_crear_proyecto(self):
        user = User.objects.create(username="******",password="******")
        
        tk = TaskFactory(user=user, name='in_progress', started=True, project=None)
        tk.start()

        factory = RequestFactory()

        request = factory.post("/fasttask")
        request.user = user
        request.POST["taskName"] = "TestTask"
        request.POST["newProjectName"] = ""
        request.POST["choisebuttom"] = "Stop"

        fast_task(request)

        tasks_stopped = Task.objects.filter(started=False).count()
        projects_number = Project.objects.all().count()
        self.assertEqual(tasks_stopped+projects_number,0)