Exemplo n.º 1
0
    def test_partial_case(self):
        it = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
        it.save()
        us1 = UserStory(name='User story A', 
                    state=20, project=self.p1, iteration = it)
        us1.save()
        
        t1 = Task(name='Task 1 for US A', user_story = us1, owner= self.user1)
        t2 = Task(estimate=5, name='Task 2 for US A', user_story = us1, owner= self.user2)
        t3 = Task(estimate=10, name='Task 1 for US A', user_story = us1)
        for t in t1, t2, t3:
            t.save()



        tl1 = TaskLog(task=t1, summary="tasklog 1 for Task 1A", time_on_task=1, date=datetime.datetime.now(), owner=self.user1, iteration=it)
        tl2 = TaskLog(task=t2, summary="tasklog 2 for Task 2A", time_on_task=2, date=datetime.datetime.now(), 
owner=self.user1, iteration=it)
        for tl in tl1, tl2:
            tl.save()

        self.assertEqual(it.estimated_without_owner, 10)
        self.assertEqual(it.user_estimated(self.user1.id), 0)
        self.assertEqual(it.user_progress(self.user1.id), 3)
        self.assertEqual(it.user_estimated(self.user2.id), 5)
        self.assertEqual(it.user_progress(self.user2.id), 0)
        self.assertEqual(it.users_total_status, 
            [{'name':self.user1.username,'progress':3, 'estimated':0},
             {'name':self.user2.username,'progress':0, 'estimated':5},
             {'name':'no owner','progress':'', 'estimated':10},
            ]        
        )
Exemplo n.º 2
0
 def test_empty_case(self):
     it = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
     it.save()
     self.assertEqual(it.estimated_without_owner, 0)
     self.assertEqual(it.user_estimated(self.user1.id), 0)
     self.assertEqual(it.user_progress(self.user1.id), 0)
     self.assertEqual(it.user_estimated(self.user2.id), 0)
     self.assertEqual(it.user_progress(self.user2.id), 0)
     self.assertEqual(it.users_total_status, 
         [{'name':self.user1.username,'progress':0, 'estimated':0},
          {'name':self.user2.username,'progress':0, 'estimated':0},
          {'name':'no owner','progress':'', 'estimated':0},
         ]        
     )
Exemplo n.º 3
0
    def test_complete_case(self):
        it = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
        it.save()
        us1 = UserStory(name='User story A', 
                    planned=45, state=20, project=self.p1, iteration = it)
        us2 = UserStory(name='User story B', 
                    planned=30, state=30, project=self.p1, iteration = it)
        us1.save()
        us2.save()
        t1 = Task(estimate=10, name='Task 1 for US A', user_story = us1, owner= self.user1)
        t2 = Task(estimate=5, name='Task 2 for US A', user_story = us1, owner= self.user2)
        t3 = Task(estimate=1, name='Task 1 for US B', user_story = us2, owner= self.user1)
        t4 = Task(estimate=2, name='Task 2 for US B', user_story = us2, owner= self.user2)
        t5 = Task(estimate=5, name='Task 2 for US B', user_story = us2)
        t6 = Task(estimate=4, name='Task 2 for US B', user_story = us2)
        for t in t1, t2, t3, t4, t5, t6:
            t.save()
        tl1 = TaskLog(task=t1, summary="tasklog 1 for Task 1A", time_on_task=1, date=datetime.datetime.now(), owner=self.user1, iteration=it)
        tl2 = TaskLog(task=t2, summary="tasklog 2 for Task 2A", time_on_task=2, date=datetime.datetime.now(), owner=self.user1, iteration=it)
        tl3 = TaskLog(task=t3, summary="tasklog 1 for Task 1B", time_on_task=3, date=datetime.datetime.now(), owner=self.user2, iteration=it)
        tl4 = TaskLog(task=t4, summary="tasklog 2 for Task 2B", time_on_task=5, date=datetime.datetime.now(), owner=self.user2, iteration=it)        
        for tl in tl1, tl2, tl3, tl4:
            tl.save()

        self.assertEqual(it.estimated_without_owner, 9)
        self.assertEqual(it.user_estimated(self.user1.id), 11)
        self.assertEqual(it.user_estimated(self.user2.id), 7)
        self.assertEqual(it.user_progress(self.user1.id), 3)
        self.assertEqual(it.user_progress(self.user2.id), 8)
        self.assertEqual(it.users_total_status, 
            [{'name':self.user1.username,'progress':3, 'estimated':11},
             {'name':self.user2.username,'progress':8, 'estimated':7},
             {'name':'no owner','progress':'', 'estimated':9},
            ]        
        )