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


Python models.Patch类代码示例

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


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

示例1: _insert_patch

 def _insert_patch(self):
     patch = Patch(project=defaults.project,
                   submitter=defaults.patch_author_person,
                   msgid=defaults.patch_name,
                   content=defaults.patch)
     patch.save()
     return patch
开发者ID:asdil12,项目名称:patchwork,代码行数:7,代码来源:test_xmlrpc.py

示例2: MboxPatchResponseTest

class MboxPatchResponseTest(TestCase):
    fixtures = ['default_states']

    """ Test that the mbox view appends the Acked-by from a patch comment """

    def setUp(self):
        defaults.project.save()

        self.person = defaults.patch_author_person
        self.person.save()

        self.patch = Patch(project=defaults.project,
                           msgid='p1', name='testpatch',
                           submitter=self.person, diff='',
                           content='comment 1 text\nAcked-by: 1\n')
        self.patch.save()

        comment = Comment(submission=self.patch,
                          msgid='p2',
                          submitter=self.person,
                          content='comment 2 text\nAcked-by: 2\n')
        comment.save()

    def testPatchResponse(self):
        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response,
                            'Acked-by: 1\nAcked-by: 2\n')
开发者ID:doanac,项目名称:patchwork,代码行数:27,代码来源:test_mboxviews.py

示例3: MboxDateHeaderTest

class MboxDateHeaderTest(TestCase):
    """ Test that the date provided in the patch mail view is correct """

    def setUp(self):
        defaults.project.save()
        self.person = defaults.patch_author_person
        self.person.save()

        self.patch = Patch(project = defaults.project,
                           msgid = 'p1', name = 'testpatch',
                           submitter = self.person, content = '')
        self.patch.save()

    def testDateHeader(self):
        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        mail = email.message_from_string(response.content)
        mail_date = dateutil.parser.parse(mail['Date'])
        # patch dates are all in UTC
        patch_date = self.patch.date.replace(tzinfo=dateutil.tz.tzutc(),
                                            microsecond=0)
        self.assertEqual(mail_date, patch_date)

    def testSuppliedDateHeader(self):
        hour_offset = 3
        tz = dateutil.tz.tzoffset(None, hour_offset * 60 * 60)
        date = datetime.datetime.utcnow() - datetime.timedelta(days = 1)
        date = date.replace(tzinfo=tz, microsecond=0)

        self.patch.headers = 'Date: %s\n' % date.strftime("%a, %d %b %Y %T %z")
        self.patch.save()

        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        mail = email.message_from_string(response.content)
        mail_date = dateutil.parser.parse(mail['Date'])
        self.assertEqual(mail_date, date)
开发者ID:tklengyel,项目名称:patchwork,代码行数:35,代码来源:test_mboxviews.py

示例4: MboxCommentPostcriptUnchangedTest

class MboxCommentPostcriptUnchangedTest(TestCase):
    """ Test that the mbox view doesn't change the postscript part of a mail.
        There where always a missing blank right after the postscript
        delimiter '---' and an additional newline right before. """
    def setUp(self):
        defaults.project.save()

        self.person = defaults.patch_author_person
        self.person.save()

        self.patch = Patch(project = defaults.project,
                           msgid = 'p1', name = 'testpatch',
                           submitter = self.person, content = '')
        self.patch.save()

        self.txt = 'some comment\n---\n some/file | 1 +\n'

        comment = Comment(patch = self.patch, msgid = 'p1',
                submitter = self.person,
                content = self.txt)
        comment.save()

    def testCommentUnchanged(self):
        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response, self.txt)
        self.txt += "\n"
        self.assertNotContains(response, self.txt)
开发者ID:tklengyel,项目名称:patchwork,代码行数:27,代码来源:test_mboxviews.py

示例5: MboxPatchSplitResponseTest

class MboxPatchSplitResponseTest(TestCase):
    """ Test that the mbox view appends the Acked-by from a patch comment,
        and places it before an '---' update line. """
    def setUp(self):
        defaults.project.save()

        self.person = defaults.patch_author_person
        self.person.save()

        self.patch = Patch(project = defaults.project,
                           msgid = 'p1', name = 'testpatch',
                           submitter = self.person, content = '')
        self.patch.save()
        comment = Comment(patch = self.patch, msgid = 'p1',
                submitter = self.person,
                content = 'comment 1 text\nAcked-by: 1\n---\nupdate\n')
        comment.save()

        comment = Comment(patch = self.patch, msgid = 'p2',
                submitter = self.person,
                content = 'comment 2 text\nAcked-by: 2\n')
        comment.save()

    def testPatchResponse(self):
        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response,
                'Acked-by: 1\nAcked-by: 2\n')
开发者ID:tklengyel,项目名称:patchwork,代码行数:27,代码来源:test_mboxviews.py

示例6: MboxGeneratedHeaderTest

class MboxGeneratedHeaderTest(TestCase):
    fixtures = ['default_states']

    def setUp(self):
        defaults.project.save()
        self.person = defaults.patch_author_person
        self.person.save()

        self.user = create_user()

        self.patch = Patch(project=defaults.project,
                           msgid='p1',
                           name='testpatch',
                           submitter=self.person,
                           delegate=self.user,
                           content='')
        self.patch.save()

    def testPatchworkIdHeader(self):
        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response, 'X-Patchwork-Id: %d' % self.patch.id)

    def testPatchworkDelegateHeader(self):
        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response,
                            'X-Patchwork-Delegate: %s' % self.user.email)
开发者ID:doanac,项目名称:patchwork,代码行数:26,代码来源:test_mboxviews.py

示例7: MboxPassThroughHeaderTest

class MboxPassThroughHeaderTest(TestCase):
    """ Test that we see 'Cc' and 'To' headers passed through from original
        message to mbox view """

    def setUp(self):
        defaults.project.save()
        self.person = defaults.patch_author_person
        self.person.save()

        self.cc_header = 'Cc: CC Person <[email protected]>'
        self.to_header = 'To: To Person <[email protected]>'

        self.patch = Patch(project = defaults.project,
                           msgid = 'p1', name = 'testpatch',
                           submitter = self.person, content = '')

    def testCCHeader(self):
        self.patch.headers = self.cc_header + '\n'
        self.patch.save()

        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response, self.cc_header)

    def testToHeader(self):
        self.patch.headers = self.to_header + '\n'
        self.patch.save()

        response = self.client.get('/patch/%d/mbox/' % self.patch.id)
        self.assertContains(response, self.to_header)
开发者ID:asl,项目名称:llvm-patchwork,代码行数:29,代码来源:mboxviews.py

示例8: _insert_patch

 def _insert_patch(self):
     patch = Patch(project=defaults.project,
                   submitter=defaults.patch_author_person,
                   msgid=make_msgid(),
                   content=defaults.patch,
                   date=self.last_patch_ts)
     self.last_patch_ts += datetime.timedelta(0, 1)
     patch.save()
     return patch
开发者ID:anderco,项目名称:patchwork,代码行数:9,代码来源:test_xmlrpc.py

示例9: setUp

    def setUp(self):
        defaults.project.save()

        for (name, email, date) in self.patchmeta:
            patch_name = 'testpatch' + name
            person = Person(name = name, email = email)
            person.save()
            patch = Patch(project = defaults.project, msgid = patch_name,
                        submitter = person, content = '', date = date)
            patch.save()
开发者ID:lsandoval,项目名称:patchwork,代码行数:10,代码来源:test_list.py

示例10: testList

    def testList(self):
        defaults.project.save()
        defaults.patch_author_person.save()
        patch = Patch(project = defaults.project,
                submitter = defaults.patch_author_person,
                msgid = defaults.patch_name,
                content = defaults.patch)
        patch.save()

        patches = self.rpc.patch_list()
        self.assertEqual(len(patches), 1)
        self.assertEqual(patches[0]['id'], patch.id)
开发者ID:computersforpeace,项目名称:patchwork,代码行数:12,代码来源:test_xmlrpc.py

示例11: create_patches

def create_patches(count=1):
    """Create 'count' unique patches."""
    defaults.project.save()
    defaults.patch_author_person.save()

    patches = []

    for i in range(0, count):
        patch = Patch(project=defaults.project,
                      submitter=defaults.patch_author_person,
                      msgid=make_msgid(),
                      name='testpatch%d' % (i + 1),
                      diff=defaults.patch)
        patch.save()
        patches.append(patch)

    return patches
开发者ID:doanac,项目名称:patchwork,代码行数:17,代码来源:utils.py

示例12: setUp

    def setUp(self):
        defaults.project.save()
        self.person = defaults.patch_author_person
        self.person.save()

        self.patch = Patch(project = defaults.project,
                           msgid = 'p1', name = 'testpatch',
                           submitter = self.person, content = '')
        self.patch.save()
开发者ID:tklengyel,项目名称:patchwork,代码行数:9,代码来源:test_mboxviews.py

示例13: setUp

 def setUp(self):
     self.project = defaults.project
     self.project.send_notifications = True
     self.project.save()
     self.submitter = defaults.patch_author_person
     self.submitter.save()
     self.patch = Patch(project = self.project, msgid = 'testpatch',
                     name = 'testpatch', content = '',
                     submitter = self.submitter)
开发者ID:tijuca,项目名称:patchwork,代码行数:9,代码来源:notifications.py

示例14: setUp

    def setUp(self, patch_count=3):
        patch_names = ['testpatch%d' % (i) for i in range(1, patch_count+1)]
        self.user = create_user()
        self.client.login(username = self.user.username,
                password = self.user.username)
        defaults.project.save()
        self.bundle = Bundle(owner = self.user, project = defaults.project,
                name = 'testbundle')
        self.bundle.save()
        self.patches = []

        for patch_name in patch_names:
            patch = Patch(project = defaults.project,
                               msgid = patch_name, name = patch_name,
                               submitter = Person.objects.get(user = self.user),
                               content = '')
            patch.save()
            self.patches.append(patch)
开发者ID:lsandoval,项目名称:patchwork,代码行数:18,代码来源:test_bundles.py

示例15: setUp

 def setUp(self):
     project = defaults.project
     defaults.project.save()
     defaults.patch_author_person.save()
     self.patch = Patch(project=project,
                        msgid='x', name=defaults.patch_name,
                        submitter=defaults.patch_author_person,
                        diff='')
     self.patch.save()
     self.user = create_user()
开发者ID:doanac,项目名称:patchwork,代码行数:10,代码来源:test_checks.py


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