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


Python Issue.add_group方法代码示例

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


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

示例1: ErrorTests

# 需要导入模块: from issues.models import Issue [as 别名]
# 或者: from issues.models.Issue import add_group [as 别名]
class ErrorTests(TestCase):
    # test the view for writing errors
    def setUp(self):
        for issue in Issue.all(): issue.delete()
        for log in Log.all(): log.delete()
        for comment in Comment.all(): comment.delete()
        for group in Group.all(): group.delete()
        for error in Error.all(): error.delete()
        for project in Project.all(): project.delete()

    def testLogAdded(self):
        issue = Issue()
        issue.description = "This is a test"
        issue.save()

        assert issue.log_set[0]

    def _setup(self):
        self.project = Project(name="testing")
        self.project.save()

        self.url = ProjectURL(url="http://test.areciboapp.com")
        self.url.project = self.project
        self.url.save()

        self.url = ProjectURL(url="http://www.areciboapp.com")
        self.url.project = self.project
        self.url.save()

        self.error = Error()
        for k, v in break_url("http://test.areciboapp.com/an/other").items():
            setattr(self.error, k, v)
        self.error.save()

    def _issue(self):
        self.issue = Issue()
        self.issue.description = "This is a test"
        self.issue.save()

    def testIssueGroup(self):
        self._setup()

        self._issue()

        group = Group.all()[0]
        self.issue.add_group(group)

        assert group == self.issue.issuegroup_set[0].group
        assert self.issue.issuegroup_set.count() == 1

        assert self.issue == IssueGroup.all().filter("issue = ", self.issue)[0].issue

    def testIssueURL(self):
        self._setup()

        self.issue = Issue()
        self.issue.description = "This is a test"
        self.issue.project = self.project
        self.issue.save()

        assert self.issue.issueprojecturl_set.count() == 2
        assert self.issue.issueprojecturl_set[0].status == "not_fixed"

    def testIssueURLFlexibility(self):
        self._setup()

        self._issue()
        assert self.issue == issue_by_number(self.issue.number)
        assert self.issue == issue_by_number(self.issue.number)

    def testIssueChanged(self):
        self.signal_fired = False
        def signal_fired(instance, old, **kw):
            self.signal_fired = True
        signals.issue_changed.connect(signal_fired, dispatch_uid="issue_changed")
        self._issue()
        self.issue.status = "rejected"
        self.issue.save()
        assert self.signal_fired

    def testIssuePriorityChanged(self):
        self.signal_fired = False
        def signal_fired(instance, old, new, **kw):
            self.signal_fired = True
            assert old in (None, 1)
            assert new in (1, 2)

        signals.issue_priority_changed.connect(signal_fired, dispatch_uid="issue_priority_changed")

        self._issue()
        self.issue.priority = 1
        self.issue.save()
        assert self.signal_fired

        self.signal_fired = False
        self.issue.priority = 2
        self.issue.save()
        assert self.signal_fired

    def testIssueStatusChanged(self):
#.........这里部分代码省略.........
开发者ID:alanjds,项目名称:arecibo,代码行数:103,代码来源:tests.py


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