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


Python models.Project类代码示例

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


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

示例1: test_empty_case

 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,代码行数:7,代码来源:unit.py

示例2: setUp

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

示例3: touch_cache

def touch_cache(request, project_id):
    response = HttpResponse(mimetype="text/plain")
    if CACHE_ENABLED:
        Project.touch_cache(project_id)
        response.write("Touched cache for project %s\n" % project_id)
        response.write("CACHE_PREFIX=%s\n" % CACHE_PREFIX)
    else:
        response.write("Caching is disabled")
    return response
开发者ID:httpdss,项目名称:ajellito,代码行数:9,代码来源:tools.py

示例4: invalidate_cache

def invalidate_cache(sender, instance, **kwargs):
    from agilito.models import Project
    ids = []

    if isinstance(instance, User):
        ids = [p.id for p in instance.project_set.all()]
    elif hasattr(instance, 'project'):
        ids = [instance.project.id]

    for id in ids:
        
        Project.touch_cache(id)
开发者ID:mreperger,项目名称:ajellito,代码行数:12,代码来源:utils.py

示例5: IterationStatusTestCase

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,代码行数:49,代码来源:unit.py

示例6: setUp

    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()
开发者ID:httpdss,项目名称:agilito,代码行数:29,代码来源:us49.py

示例7: f_cached

    def f_cached(*args, **kwargs):
        global CACHE_ENABLED

        if not CACHE_ENABLED:
            return f(*args, **kwargs)

        params = f.func_code.co_varnames[1:f.func_code.co_argcount]
        vardict = dict(zip(params, ['<default>' for d in params]))
        vardict.update(dict(zip(params, args[1:])))
        vardict.update(kwargs)
        u = args[0].user  # request.user

        pv = Project.cache_id(vardict["project_id"])

        key = "%s.agilito.views.%s(%s)" % (CACHE_PREFIX, f.__name__, ",".join([str(vardict[v]) for v in params]))

        v = cache.get(key + "#version")
        if v == pv:
            v = cache.get(key + "#value")
            if not v is None:
                return v

        v = f(*args, **kwargs)
        cache.set(key + '#version', pv, 1000000)
        cache.set(key + '#value', v, 1000000)

        return v
开发者ID:httpdss,项目名称:ajellito,代码行数:27,代码来源:tools.py

示例8: f_cached

    def f_cached(*args, **kwargs):
        global CACHE_ENABLED

        self = args[0]
        if not CACHE_ENABLED or not hasattr(self, 'project_id'):
            return f(*args, **kwargs)

        params = f.func_code.co_varnames[:f.func_code.co_argcount]
        vardict = dict(zip(params, ['<None>' for d in params]))
        vardict.update(dict(zip(f.func_code.co_varnames, args)))
        vardict.update(kwargs)
        # replace 'self' with module:class:id:method 
        obj = '%s.%s.%s(%s' % (self.__class__.__module__, self.__class__.__name__, f.__name__, str(self.id))
        vardict['self'] = obj
        
        from agilito.models import Project

        pv = Project.cache_id(self.project_id)

        key = CACHE_PREFIX + '.'
        key += ','.join([str(vardict[v]) for v in params]) + ')'
        v = cache.get(key + '#version')
        if v == pv:
            v = cache.get(key + '#value')
            if not v is None:
                return v

        v = f(*args, **kwargs)
        cache.set(key + '#version', pv, 1000000)
        cache.set(key + '#value', v, 1000000)

        return v
开发者ID:mreperger,项目名称:ajellito,代码行数:32,代码来源:utils.py

示例9: test_full_case

    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,代码行数:16,代码来源:unit.py

示例10: TestTestCaseEditForm

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,代码行数:44,代码来源:unit.py

示例11: setUp

 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()
开发者ID:httpdss,项目名称:ajellito,代码行数:20,代码来源:us34.py

示例12: TestTaskForm

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,代码行数:41,代码来源:unit.py

示例13: setUp

    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()
开发者ID:httpdss,项目名称:ajellito,代码行数:18,代码来源:backlog.py

示例14: TestUS34

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,代码行数:46,代码来源:us34.py

示例15: TestBacklogAddUSDetailed

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,代码行数:42,代码来源:backlog.py


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