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


Python ProjectIssue.add方法代码示例

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

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

示例1: test_gets_by_project_ids

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_gets_by_project_ids(self):
        p1 = ProjectIssue.add('test1', 'desp', 'test', project=1)
        p2 = ProjectIssue.add('test2', 'desp', 'test2', project=2)
        p3 = ProjectIssue.add('test3', 'desp', 'test3', project=2)

        issues = ProjectIssue.gets_by_project_ids([1, 2])

        assert len(issues), 3
        for p in [p1, p2, p3]:
            p.delete()
开发者ID:000fan000,项目名称:code,代码行数:12,代码来源:test_project_issue.py


示例2: test_open_and_close_issue

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_open_and_close_issue(self):
        p1 = ProjectIssue.add('test1', 'test1 description', 'test', project=1)
        p2 = ProjectIssue.add('test2', 'test2 description', 'test', project=1)
        p3 = ProjectIssue.add('test3', 'test3 description', 'test', project=1)

        count = ProjectIssue.get_count_by_project_id(1)
        assert count == 3
        p1.close('test')
        count = ProjectIssue.get_count_by_project_id(1, 'open')
        assert count == 2
        p1.open()
        count = ProjectIssue.get_count_by_project_id(1, 'open')
        assert count == 3
开发者ID:leeccong,项目名称:code,代码行数:15,代码来源:test_project_issue.py


示例3: test_zero_vote_and_zero_comment_display

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_zero_vote_and_zero_comment_display(self):
        app = TestApp(M.app)
        project_name = "project"
        delete_project(project_name)
        project = CodeDoubanProject.add(
            project_name, owner_id="test1", summary="test", product="fire")
        ProjectIssue.add('test', 'test description', 'test',
                         project=project.id)
        resp = app.get(project.url + "/issues/")

        assert resp.status_int == 200
        assert 'Issues' in resp.body
        assert '0 vote' not in resp.body
        assert '0 comment' not in resp.body
开发者ID:000fan000,项目名称:code,代码行数:16,代码来源:test_issue_votes_and_comments_count_display.py


示例4: create

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def create(self, request):
        if request.method == 'POST':
            user = request.user
            if not user:
                raise AccessError
            project = request.get_form_var('project')
            title = request.get_form_var('title', '').decode('utf-8')
            description = request.get_form_var('body', '').decode('utf-8')
            tags = request.get_form_var('issue_tags', [])
            if isinstance(tags, list):
                tags = [tag.decode('utf-8') for tag in tags if tag]
            elif isinstance(tags, basestring):
                tags = [tags.decode('utf-8')]

            if not project:
                raise TraversalError
            if not title.strip():
                return request.redirect('/%s/issues/new?error=empty' % project)
            project = CodeDoubanProject.get_by_name(project)
            pissue = ProjectIssue.add(title, description, user.name,
                                      project=project.id)
            pissue.add_tags(tags, pissue.project_id)
            # TODO: 重构feed后取消信号发送
            issue_signal.send(author=user.name, content=description,
                              issue_id=pissue.issue_id)
            dispatch('issue', data={
                     'sender': user.name,
                     'content': description,
                     'issue': pissue
                     })
            return request.redirect(pissue.url)
        project_name = self.proj_name
        return request.redirect('/%s/issues' % project_name)
开发者ID:000fan000,项目名称:code,代码行数:35,代码来源:issue.py


示例5: setUp

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def setUp(self):
     super(ProjectIssueCommentsTest, self).setUp()
     project_name = "code"
     product_name = "fire"
     summary = "test"
     owner_id = "lisong_intern"
     delete_project(project_name)
     project = CodeDoubanProject.add(
         project_name,
         owner_id=owner_id,
         summary=summary,
         product=product_name
     )
     self.project = project
     title = "test title"
     description = "test desc"
     creator = "test"
     issue = ProjectIssue.add(
         title,
         description,
         creator,
         project=self.project.id
     )
     self.issue = issue
     self.project = project
     self.comment1 = IssueComment.add(
         self.issue.issue_id, 'content1', 'test1')
     self.comment2 = IssueComment.add(
         self.issue.issue_id, 'content2', 'test2')
     self.api_token = self.create_api_token('test1')
     self.api_token2 = self.create_api_token('test2')
开发者ID:000fan000,项目名称:code,代码行数:33,代码来源:test_project_issue_comments.py


示例6: test_single_project

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_single_project(self):
        skip_test()
        u_to = User("admin")
        u_from = User("testuser")
        to_proj = self._prj("test", "admin")
        self._add(to_proj, u_to, "README.md", "hi")
        from_proj = self._prj("testuser/test", "testuser", to_proj.id)
        self._add(from_proj, u_from, "README.md", "hello")
        pullreq = PullRequest.open(from_proj, "master", to_proj, "master")
        ticket = Ticket(None, None, to_proj.id, "title", "desc", "testuser",
                        None, None)
        pullreq = add_pull(ticket, pullreq, u_from)

        iss = ProjectIssue.add(title='title1', description='desc1',
                               creator='owner', project=to_proj.id)
        IssuePRSearch.index_a_project(to_proj)
        res = IssueSearch.search_a_phrase('title1', to_proj.id)
        res = SearchEngine.decode(res, ('issue_id',))
        res = [id for id, in res]
        assert len(res) == 1
        assert res[0] == iss.id
        res = PullRequestSearch.search_a_phrase('title', to_proj.id)
        res = SearchEngine.decode(res, ('issue_id',))
        res = [id for id, in res]
        assert len(res) == 1
开发者ID:leeccong,项目名称:code,代码行数:27,代码来源:test_search.py


示例7: test_add_issue

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def test_add_issue(self):
     p = ProjectIssue.add('test', 'test description', 'test', project=1)
     assert isinstance(p, ProjectIssue)
     assert p.title == 'test'
     assert p.description == 'test description'
     assert p.project_id == 1
     p.delete()
开发者ID:000fan000,项目名称:code,代码行数:9,代码来源:test_project_issue.py


示例8: test_n_issue

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_n_issue(self):
        p1 = ProjectIssue.add(
            'test1', 'test1 description', 'test', project=1,
            assignee='assignee')
        p1.close('test')
        p2 = ProjectIssue.add(
            'test2', 'test2 description', 'test', project=1,
            assignee='assignee')
        p2.close('test')
        p3 = ProjectIssue.add(
            'test3', 'test3 description', 'test', project=1,
            assignee='assignee')
        p4 = ProjectIssue.add(
            'test4', 'test4 description', 'test', project=1,
            assignee='test')
        p5 = ProjectIssue.add(
            'test5', 'test5 description', 'test1', project=2,
            assignee='test')

        count = ProjectIssue.get_count_by_project_id(1)
        assert count == 4
        count = ProjectIssue.get_count_by_project_id(1, 'open')
        assert count == 2
        count = ProjectIssue.get_count_by_project_id(1, 'closed')
        assert count == 2

        count = ProjectIssue.get_count_by_assignee_id(1, 'assignee')
        assert count == 3
        count = ProjectIssue.get_count_by_assignee_id(1, 'assignee', 'open')
        assert count == 1
        count = ProjectIssue.get_count_by_assignee_id(1, 'assignee', 'closed')
        assert count == 2

        count = ProjectIssue.get_count_by_creator_id(1, 'test')
        assert count == 4
        count = ProjectIssue.get_count_by_creator_id(1, 'test', 'open')
        assert count == 2
        count = ProjectIssue.get_count_by_creator_id(1, 'test', 'closed')
        assert count == 2

        r = ProjectIssue.get(p1.project_id, p1.issue_id)
        assert isinstance(r, ProjectIssue)
        assert r.n_closed_issues == 2
        assert r.n_open_issues == 2

        for p in [p1, p2, p3, p4, p5]:
            p.delete()
开发者ID:000fan000,项目名称:code,代码行数:49,代码来源:test_project_issue.py


示例9: setUp

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def setUp(self):
     TestCase.setUp(self)
     self.testuser1 = 'testuser1'
     self.testuser2 = 'testuser2'
     self.testuser3 = 'testuser3'
     self.test_team_issue = TeamIssue.add('test', 'test description',
                                          self.testuser1, team=1)
     self.test_project_issue = ProjectIssue.add(
         'test',  'test description', self.testuser1, project=1)
开发者ID:000fan000,项目名称:code,代码行数:11,代码来源:test_issue_upvote.py


示例10: test_get_issue

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_get_issue(self):
        p = ProjectIssue.add('test', 'test description', 'test', project=1)
        r = ProjectIssue.get(p.project_id, issue_id=p.issue_id)
        assert isinstance(r, ProjectIssue)
        assert r.project_id == 1

        r = ProjectIssue.get(p.project_id, number=p.number)
        assert isinstance(r, ProjectIssue)
        assert r.project_id == 1

        r = Issue.get_cached_issue(p.issue_id)
        assert isinstance(r, ProjectIssue)
        assert r.title == 'test'
        assert r.description == 'test description'
        assert r.project_id == 1

        p2 = ProjectIssue.add(
            'test2', 'test2 description', 'test', project=1,
            assignee='assignee')
        p3 = ProjectIssue.add(
            'test3', 'test3 description', 'test', project=1,
            assignee='assignee')
        p4 = ProjectIssue.add(
            'test4', 'test4 description', 'test', project=1, assignee='test')
        p5 = ProjectIssue.add(
            'test5', 'test5 description', 'test1', project=2, assignee='test')

        rs = ProjectIssue._gets_by_project_id(1)
        assert len(rs) == 4

        rs = ProjectIssue._get_issues_by_project_id(1)
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 4

        rs = ProjectIssue.gets_by_assignee_id(1, 'assignee')
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 2

        rs = ProjectIssue.gets_by_creator_id(1, 'test')
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 4

        for p in [p, p2, p3, p4, p5]:
            p.delete()
开发者ID:000fan000,项目名称:code,代码行数:46,代码来源:test_project_issue.py


示例11: test_upate_issue_not_author_fail

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def test_upate_issue_not_author_fail(self):
     issue = ProjectIssue.add("old title", "old desc", self.username, project=self.project.id)
     title = "new title"
     description = "new desc"
     ret = self.app.patch_json(
         "/api/%s/issues/%s/" % (self.project.name, issue.number),
         dict(title=title, description=description),
         headers=dict(Authorization="Bearer %s" % self.api_token2.token),
         status=403,
     ).json
     self.assertProblemType(ret["type"], "not_the_author")
开发者ID:leeccong,项目名称:code,代码行数:13,代码来源:test_project_issue.py


示例12: test_multiple_project

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def test_multiple_project(self):
     skip_test()
     p1 = self._prj("test_1")
     p2 = self._prj("test_2")
     iss1 = ProjectIssue.add(title='title1', description='desc1',
                             creator='owner', project=p1.id)
     iss2 = ProjectIssue.add(title='title1', description='desc1',
                             creator='owner', project=p2.id)
     IssueSearch.index_a_project_issue(p1)
     IssueSearch.index_a_project_issue(p2)
     res = IssueSearch.search_a_phrase('title1', p1.id)
     res = SearchEngine.decode(res, ('issue_id',))
     res = [id for id, in res]
     assert len(res) == 1
     assert res[0] == iss1.id
     res = IssueSearch.search_a_phrase('title1', p2.id)
     res = SearchEngine.decode(res, ('issue_id',))
     res = [id for id, in res]
     assert len(res) == 1
     assert res[0] == iss2.id
开发者ID:leeccong,项目名称:code,代码行数:22,代码来源:test_search.py


示例13: test_get_issue

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
    def test_get_issue(self):
        p1 = ProjectIssue.add('test1', 'test1 description', 'test', project=1,
                              assignee='assignee')
        p1.close('test')
        p2 = ProjectIssue.add('test2', 'test2 description', 'test', project=1,
                              assignee='assignee')
        p2.close('test')
        p3 = ProjectIssue.add('test3', 'test3 description', 'test', project=1,
                              assignee='assignee')
        p4 = ProjectIssue.add('test4', 'test4 description', 'test', project=1,
                              assignee='test')
        p5 = ProjectIssue.add('test5', 'test5 description', 'test1', project=2,
                              assignee='test')

        rs = UserIssue.gets_by_creator_id('test', state='open')
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 2

        rs = UserIssue.gets_by_assignee_id('test', state='open')
        assert all([isinstance(i, ProjectIssue) for i in rs])
        assert len(rs) == 2
开发者ID:000fan000,项目名称:code,代码行数:23,代码来源:test_user_issue.py


示例14: setUp

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def setUp(self):
     super(TestCase, self).setUp()
     self.project = get_temp_project()
     self.issue = ProjectIssue.add('test',
                                   'test description',
                                   'test',
                                   project=self.project.id)
     user = User('testuser')
     project = self.project
     name = "Test Milestone 1"
     ms = Milestone.create_by_project(project, name, user)
     self.milestone = ms
开发者ID:000fan000,项目名称:code,代码行数:14,代码来源:test_issue_milestone.py


示例15: test_get_single_issue

# 需要导入模块: from vilya.models.project_issue import ProjectIssue [as 别名]
# 或者: from vilya.models.project_issue.ProjectIssue import add [as 别名]
 def test_get_single_issue(self):
     title = "test title"
     description = "test desc"
     creator = "test"
     issue = ProjectIssue.add(title, description, creator, project=self.project.id)
     IssueComment.add(issue.issue_id, "content", "test")
     ret = self.app.get("/api/%s/issues/%s/" % (self.project.name, issue.number), status=200).json
     self.assertEquals(ret["title"], title)
     self.assertEquals(ret["description"], description)
     self.assertEquals(ret["creator"], creator)
     self.assertEquals(ret["project"], self.project.name)
     self.assertEquals(ret["comments"], 1)
开发者ID:leeccong,项目名称:code,代码行数:14,代码来源:test_project_issue.py



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