当前位置: 首页>>代码示例>>Python>>正文


Python Project.save方法代码示例

本文整理汇总了Python中agilito.models.Project.save方法的典型用法代码示例。如果您正苦于以下问题:Python Project.save方法的具体用法?Python Project.save怎么用?Python Project.save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在agilito.models.Project的用法示例。


在下文中一共展示了Project.save方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_empty_case

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
 def test_empty_case(self):
     p1 = Project()
     p1.save()
     usf = UserStoryForm(project=p1)
     itfield = usf.fields['iteration']
     choices = [c for c in itfield.choices]
     self.assertEqual(choices, [(u'', u'---------')])
开发者ID:mreperger,项目名称:ajellito,代码行数:9,代码来源:unit.py

示例2: TestUS49Base

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestUS49Base(SeleniumBase):
    def setUp(self):
        self.user = User(username = 'User A')
        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()
开发者ID:httpdss,项目名称:agilito,代码行数:36,代码来源:us49.py

示例3: IterationStatusTestCase

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class IterationStatusTestCase(test.TestCase):
    def setUp(self):
        super(IterationStatusTestCase, self).setUp()

        self.p1 = Project()
        self.p1.save()
        #self.i2 = Iteration(start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project=self.p1)
        #self.i2.save()

    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)

    def test_start_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', project=self.p1, iteration = it)
        us2 = UserStory(name='User story B', planned=10, project=self.p1, iteration = it)
        us3 = UserStory(name='User story C', planned=15, project=self.p1, iteration = it)
        us1.save()
        us2.save()
        us3.save()
        self.assertEqual(it.us_accepted_percentage, 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)
        
    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)
开发者ID:mreperger,项目名称:ajellito,代码行数:51,代码来源:unit.py

示例4: test_full_case

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
    def test_full_case(self):
        p1 = Project()
        p1.save()
        it1 = Iteration(name='Iteration A', start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project = p1)
        it2 = Iteration(name='Iteration B', start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project = p1)
        it3 = Iteration(name='Iteration C', start_date=datetime.datetime.now(), end_date=datetime.datetime.now(), project = p1)
        for it in it1, it2, it3:        
            it.save()

        usf = UserStoryForm(project=p1)
        itfield = usf.fields['iteration']
        choices = [c for c in itfield.choices]
        echoices = [(u'', u'---------')]
        for it in it3, it2, it1:
            echoices += [(it.id,'IT%d: %s'%(it.id, it.name))]
        self.assertEqual(choices, echoices)
开发者ID:mreperger,项目名称:ajellito,代码行数:18,代码来源:unit.py

示例5: TestTestCaseEditForm

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestTestCaseEditForm(test.TestCase):
    fixtures = ['database_dump.json']

    def setUp(self):
        self.p1 = Project(name='Test Project 1')
        self.p2 = Project(name='Test Project 2')
        
        self.p1.save()
        self.p2.save()
        
        self.us1 = UserStory(name='User story A', 
                    planned=45, state=20, project=self.p1)
        self.us2 = UserStory(name='User story B', 
                    planned=30, state=30, project=self.p2)
        self.us3 = UserStory(name='User story C', 
                    planned=30, state=30, project=self.p2)
        
        self.us1.save()
        self.us2.save()
        self.us3.save()

        self.tc1 = TestCase(user_story=self.us1, priority=10)
        self.tc2 = TestCase(user_story=self.us2, priority=10)

        self.tc1.save()
        self.tc2.save()


    def tearDown(self):
        for obj in self.tc1, self.tc2, self.us1, self.us2, self.p1, self.p2:
            obj.delete()

    def test_test_case_edit_form_has_current_project_us_only(self):
        form = TestCaseEditForm(project=self.tc1.user_story.project, instance=self.tc1)
        user_story_choices = list(form.fields['user_story'].choices)
        self.assertEqual(len(user_story_choices), 2)
        self.assertEqual(user_story_choices[1][1], unicode(self.us1))

    def test_test_case_edit_form_has_current_project_us_only_other(self):
        form = TestCaseEditForm(project=self.tc2.user_story.project, instance=self.tc2)
        user_story_choices = list(form.fields['user_story'].choices)
        self.assertEqual(len(user_story_choices), 3)
        self.assert_(unicode(self.us2) in set([user_story_choices[1][1], user_story_choices[2][1]]))
        self.assert_(unicode(self.us3) in set([user_story_choices[1][1], user_story_choices[2][1]]))
开发者ID:mreperger,项目名称:ajellito,代码行数:46,代码来源:unit.py

示例6: TestBacklogAddUSDetailed

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestBacklogAddUSDetailed(SeleniumBase):
    def setUp(self):
        self.user = User(username='User BBB')
        self.passwd = 'hi'
        self.user.set_password(self.passwd)
        self.user.save()
        self.project = Project(name='A Project BB')
        self.project.save()
        self.project.project_members.add(self.user)
        self.project.save()

        self.story1 = UserStory(name='User Story A', rank=3, planned=3, project=self.project)
        self.story1.save()
        self.story2 = UserStory(name='User Story B', rank=2, planned=8, project=self.project)
        self.story2.save()
        self.story3 = UserStory(name='User Story C', rank=1, planned=5, project=self.project)
        self.story3.save()
                           
        super(TestBacklogAddUSDetailed, self).setUp()

    def tearDown(self):
        self.project.delete()
        self.user.delete()
        for x in self.story1, self.story2, self.story3:
            x.delete()
        super(TestBacklogAddUSDetailed, self).tearDown()
        
    def test_create_complete_us(self):
        self.login(username='User BBB', password='hi')
        b = self.browser
        b.click("link=Backlog")
        b.wait()
        b.click("create-detailed-user-story")
        b.type("id_name", "A sample detailed user story")
        b.type("id_description", "This is a detailed user story")
        b.type("id_planned", "10")
        b.type("id_rank", "50")
        b.type("id_state", "10")
        b.click("id_blocked")
        b.click("us-create")
        self.assertEqual(b.get_text("us-span-4"),
                         "A sample detailed user story")
开发者ID:httpdss,项目名称:ajellito,代码行数:44,代码来源:backlog.py

示例7: TestTaskForm

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestTaskForm(test.TestCase):
    fixtures = ['database_dump.json']

    def setUp(self):
      
        self.p1 = Project(name='Test Project 1')
        self.p2 = Project(name='Test Project 2')
        
        self.p1.save()
        self.p2.save()

        self.p1.project_members.add(User.objects.get(pk=1))
        self.p2.project_members.add(User.objects.get(pk=2))
        self.p2.project_members.add(User.objects.get(pk=3))
        
        self.us1 = UserStory(name='User story A', 
                    planned=45, state=20, project=self.p1)
        self.us2 = UserStory(name='User story B', 
                    planned=30, state=30, project=self.p2)
        
        self.us1.save()
        self.us2.save()

    def tearDown(self):
    
        for obj in self.us1, self.us2, self.p1, self.p2:
            obj.delete()

    def test_task_form_has_only_relevant_owners_simple(self):
        form = TaskForm(project=self.p1)
        owner_choices = list(form.fields['owner'].choices)
        self.assertEqual(len(owner_choices), 2)
        self.assertEqual(owner_choices[1][1], User.objects.get(pk=1).__str__())

    def test_task_form_has_only_relevant_owners_w_instance_simple(self):
        t1 = Task(name='Task 1 for US A', user_story = self.us1, owner=User.objects.get(pk=2))
        form = TaskForm(project=self.p2, instance=t1)
        owner_choices = list(form.fields['owner'].choices)
        self.assertEqual(len(owner_choices), 3)
        self.assertEqual(owner_choices[1][1], User.objects.get(pk=2).__str__())
        self.assertEqual(owner_choices[2][1], User.objects.get(pk=3).__str__())
开发者ID:mreperger,项目名称:ajellito,代码行数:43,代码来源:unit.py

示例8: TestBacklogQuickAdd

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestBacklogQuickAdd(SeleniumBase):
    def setUp(self):
        self.user = User(username='User AB')
        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.story1 = UserStory(name='User Story A', rank=3, planned=3, project=self.project)
        self.story1.save()
        self.story2 = UserStory(name='User Story B', rank=2, planned=8, project=self.project)
        self.story2.save()
        self.story3 = UserStory(name='User Story C', rank=1, planned=5, project=self.project)
        self.story3.save()
                           
        super(TestBacklogQuickAdd, self).setUp()

    def tearDown(self):
        self.project.delete()
        self.user.delete()
        for x in self.story1, self.story2, self.story3:
            x.delete()
        super(TestBacklogQuickAdd, self).tearDown()
        
    def test_tc4(self):
        self.login(username='User AB', password='hi')
        #sel.open("/accounts/login/")
        #sel.type("id_username", "User B")
        #sel.type("id_password", "hi")
        #sel.click("//input[@value='login']")
        b = self.browser
        b.click("link=Backlog")
        b.wait()
        b.click("create-user-story")
        b.type("id_name", "A sample user story")
        b.click("us-create")
        self.assertEqual(b.get_text("us-span-4"),
                         "A sample user story")
开发者ID:httpdss,项目名称:ajellito,代码行数:43,代码来源:backlog.py

示例9: TestUS34

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestUS34(SeleniumBase):
    do_login = do_logout = False
    def setUp(self):
        self.ABC = Project(name='ABC')
        self.ABC.save()
        self.DEF = Project(name='DEF')
        self.DEF.save()
        self.EFG = Project(name='EFG')
        self.EFG.save()
        self.A = User(username='A')
        self.A.set_password('abc')
        self.A.save()
        self.B = User(username='B')
        self.B.set_password('def')
        self.B.save()
        self.C = User(username='C')
        self.C.set_password('ghi')
        self.C.save()
        self.ABC.project_members.add(self.A)
        self.ABC.project_members.add(self.B)
        self.DEF.project_members.add(self.B)
        super(TestUS34, self).setUp()

    def tearDown(self):
        for obj in (self.ABC, self.DEF, self.EFG, self.A, self.B, self.C):
            obj.delete()
        super(TestUS34, self).tearDown()

    def test_tc16(self):
        self.login(username='a', password='abc')
        self.assertEqual(self.browser.get_text('error-message'),
                         u'Username / password combination does not exist')

    def test_tc17(self):
        self.login(username='A', password='Abc')
        self.assertEqual(self.browser.get_text('error-message'),
                         u'Username / password combination does not exist')

    def test_tc18(self):
        self.login(username='A', password='abc')
        opts = self.browser.get_select_options('css=#project-selection select')
        self.assertEqual(opts, [u'ABC'])
    def test_tc19(self):
        self.login(username='B', password='def')
        opts = self.browser.get_select_options('css=#project-selection select')
        self.assertEqual(opts, [u'ABC', u'DEF'])
开发者ID:httpdss,项目名称:ajellito,代码行数:48,代码来源:us34.py

示例10: IterationStatusSummary

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class IterationStatusSummary(test.TestCase):
    def setUp(self):
        super(IterationStatusSummary, self).setUp()
        self.user1 = User(username='user1')
        self.user1.set_password('user1')
        self.user1.save()
        self.user2 = User(username='user2')
        self.user2.set_password('user2')
        self.user2.save()
        self.p1 = Project()
        self.p1.save()
        self.p1.project_members.add(self.user1)
        self.p1.project_members.add(self.user2)
        self.p1.save()
    
    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},
            ]        
        )

    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},
            ]        
        )



    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},
            ]        
        )
开发者ID:mreperger,项目名称:ajellito,代码行数:102,代码来源:unit.py

示例11: TestTestResultForm

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
class TestTestResultForm(test.TestCase):
    fixtures = ['database_dump.json']

    def setUp(self):
      
        self.p1 = Project(name='Test Project 1')
        self.p2 = Project(name='Test Project 2')
        
        self.p1.save()
        self.p2.save()

        self.p1.project_members.add(User.objects.get(pk=1))
        self.p2.project_members.add(User.objects.get(pk=2))
        self.p2.project_members.add(User.objects.get(pk=3))
        
        self.us1 = UserStory(name='User story A', 
                    planned=45, state=20, project=self.p1)
        self.us2 = UserStory(name='User story B', 
                    planned=30, state=30, project=self.p2)
        
        self.us1.save()
        self.us2.save()

        self.tc1 = TestCase(user_story=self.us1, priority=10)
        self.tc2 = TestCase(user_story=self.us2, priority=10)
        self.tc3 = TestCase(user_story=self.us2, priority=10)

        self.tc1.save()
        self.tc2.save()
        self.tc3.save()

    def tearDown(self):
        for obj in self.tc1, self.tc2, self.tc3, self.us1, self.us2, self.p1, self.p2:
            obj.delete()

    def test_test_result_form_only_test_cases_of_current_project_simple(self):
        form = TestResultForm(project=self.p1)
        test_case_choices = list(form.fields['test_case'].choices)
        self.assertEqual(len(test_case_choices), 2)
        self.assertEqual(test_case_choices[1][1], unicode(self.tc1))
        tester_choices = list(form.fields['tester'].choices)
        self.assertEqual(len(tester_choices), 2)
        self.assertEqual(tester_choices[1][1], User.objects.get(pk=1).__str__())        


    def test_test_result_form_build_with_instance_has_only_test_cases_of_current_project(self):
        test_result = TestResult(result=10, test_case=self.tc1, tester=User.objects.all()[0])
        form = TestResultForm(project=self.p1,instance=test_result)
        test_case_choices = list(form.fields['test_case'].choices)
        self.assertEqual(len(test_case_choices), 2)
        self.assertEqual(test_case_choices[1][1], unicode(self.tc1))
        tester_choices = list(form.fields['tester'].choices)
        self.assertEqual(len(tester_choices), 2)
        self.assertEqual(tester_choices[1][1], User.objects.get(pk=1).__str__())        


    def test_test_result_form_only_test_cases_of_current_project_other(self):
        form = TestResultForm(project=self.p2)
        test_case_choices = list(form.fields['test_case'].choices)
        self.assertEqual(len(test_case_choices), 3)
        self.assert_(unicode(self.tc2) in set([test_case_choices[1][1], test_case_choices[2][1]]))
        tester_choices = list(form.fields['tester'].choices)
        self.assertEqual(len(tester_choices), 3)
        self.assertEqual(tester_choices[1][1], User.objects.get(pk=2).__str__())        
开发者ID:mreperger,项目名称:ajellito,代码行数:66,代码来源:unit.py

示例12: test_cannot_reach_unassigned_project

# 需要导入模块: from agilito.models import Project [as 别名]
# 或者: from agilito.models.Project import save [as 别名]
 def test_cannot_reach_unassigned_project(self):
     user = self.login()
     p = Project(name='test')
     p.save()
     response = self.client.get('/%d/backlog/' % p.id)
     self.assertEqual(response.status_code, 404)
开发者ID:httpdss,项目名称:ajellito,代码行数:8,代码来源:ttw.py


注:本文中的agilito.models.Project.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。