Exemplo n.º 1
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},
            ]        
        )
Exemplo n.º 2
0
class TestUS49Base(SeleniumBase):
    def setUp(self):
        self.user = User(username = '******')
        self.passwd = 'hi'
        self.user.set_password(self.passwd)
        self.user.save()
        self.project = Project(name = 'A Project')
        self.project.save()
        self.project.project_members.add(self.user)
        self.project.save()
        self.iteration = Iteration(start_date = '1990-01-01',
                                   end_date = '2020-01-01',
                                   project = self.project)
        self.iteration.save()
        self.story = UserStory(name = 'ABC', project = self.project,
                               description = 'a userstory about abc',
                               iteration = self.iteration, planned = 42, rank = 1,
                               state = 10, blocked = True)
        self.story.save()
        task_states = dict((v, k) for (k, v) in Task.STATES)
        self.task_a = Task(name = "Task A", estimate = 8, remaining = 8,
                           state = task_states['In Progress'],
                           owner = self.user, user_story = self.story)
        self.task_a.save()
        self.task_b = Task(name = "Task B", estimate = 2, remaining = 2,
                           state = task_states['Defined'],
                           owner = self.user, user_story = self.story)
        self.task_b.save()

        super(TestUS49Base, self).setUp()
    def tearDown(self):
        self.project.delete()
        self.user.delete()
        super(TestUS49Base, self).tearDown()
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=10, state=40, project=self.p1, iteration = it)
     us2 = UserStory(name='User story B', 
                 planned=5, state=40, project=self.p1, iteration = it)
     us1.save()
     us2.save()
     self.assertEqual(it.us_accepted_percentage, 100)
Exemplo n.º 4
0
 def test_parcial_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)
     us3 = UserStory(name='User story C', 
                 planned=25, state=40, project=self.p1, iteration = it)
     us1.save()
     us2.save()
     us3.save()
     self.assertEqual(it.us_accepted_percentage, 25)
Exemplo n.º 5
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.º 6
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.º 7
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.us_accepted_percentage, 0)