Esempio n. 1
0
    def setUp(self):
        self.default_state = create_state()
        self.nondefault_state = create_state()

        self.patch = read_patch(self.patch_filename)
        self.user = create_user()
        self.project = create_project()
Esempio n. 2
0
    def test_duplicate_patch(self):
        diff = read_patch('0001-add-line.patch')
        m = create_email(diff, listid=self.listid, msgid='*****@*****.**')

        self._test_duplicate_mail(m)

        self.assertEqual(Patch.objects.count(), 1)
Esempio n. 3
0
    def setUp(self):
        self.p1 = Project(linkname='test-project-1',
                          name='Project 1',
                          listid='1.example.com',
                          listemail='*****@*****.**')
        self.p2 = Project(linkname='test-project-2',
                          name='Project 2',
                          listid='2.example.com',
                          listemail='*****@*****.**')

        self.p1.save()
        self.p2.save()

        patch = read_patch(self.patch_filename)
        email = create_email(self.test_comment + '\n' + patch)
        del email['Message-Id']
        email['Message-Id'] = self.msgid

        del email['List-ID']
        email['List-ID'] = '<' + self.p1.listid + '>'
        parse_mail(email)

        del email['List-ID']
        email['List-ID'] = '<' + self.p2.listid + '>'
        parse_mail(email)
Esempio n. 4
0
    def setUp(self):
        self.p = Project(linkname='test-project-1',
                         name='Project 1',
                         listid='1.example.com',
                         listemail='*****@*****.**')

        self.p.save()

        patch = read_patch(self.patch_filename)
        patch1 = create_email(self.test_comment + '\n' + patch,
                              subject="[PATCH 1/2] Meep Meep]")

        patch2 = create_email(self.test_comment + '\n' + patch,
                              subject="[PATCH 2/2] Meep Meep2]",
                              in_reply_to=patch1['Message-Id'])

        self.patch_update = create_email(self.test_comment + '\n' + patch,
                                         subject="[PATCH v2] Meep Meep2",
                                         in_reply_to=patch2['Message-Id'])

        self.comment = create_email(self.test_comment,
                                    subject="Re: [PATCH] Meep Meep2",
                                    in_reply_to=patch2['Message-Id'])

        for email in [patch1, patch2, self.patch_update, self.comment]:
            del email['List-ID']
            email['List-ID'] = '<' + self.p.listid + '>'

        parse_mail(patch1)
        parse_mail(patch2)
Esempio n. 5
0
 def setUp(self):
     project = create_project(listid='test.example.com')
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_content + '\n' + self.orig_patch,
                          project=project)
     email['Message-Id'] = '<*****@*****.**>'
     parse_mail(email)
Esempio n. 6
0
    def setUp(self):
        self.default_state = create_state()
        self.nondefault_state = create_state()

        self.patch = read_patch(self.patch_filename)
        self.user = create_user()
        self.project = create_project()
Esempio n. 7
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename, self.patch_encoding)
     email = create_email(self.test_comment + '\n' + self.orig_patch,
                          content_encoding=self.patch_encoding)
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 8
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment + '\n' + self.orig_patch)
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
     self.filenames = content.filenames
Esempio n. 9
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename, self.patch_encoding)
     email = create_email(self.test_comment + '\n' + self.orig_patch,
                          content_encoding = self.patch_encoding)
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 10
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email( \
             self.test_comment + '\n' + \
             '_______________________________________________\n' + \
             'Linuxppc-dev mailing list\n' + \
             self.orig_patch)
     (self.patch, self.comment) = find_content(self.project, email)
Esempio n. 11
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment + '\n' + self.orig_patch)
     del email['Content-Type']
     del email['Content-Transfer-Encoding']
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 12
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(
         self.test_content + '\n' +
         '_______________________________________________\n' +
         'Linuxppc-dev mailing list\n' +
         self.orig_patch)
     self.patch, _, self.filenames = find_content(self.project, email)
Esempio n. 13
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment, multipart=True)
     attachment = MIMEText(self.orig_patch, _subtype=self.content_subtype)
     email.attach(attachment)
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 14
0
 def setUp(self):
     project = create_project(listid='test.example.com')
     self.orig_diff = read_patch(self.patch_filename)
     email = create_email(self.orig_diff, listid=project.listid)
     parse_mail(email)
     email2 = create_email(self.comment_content,
                           in_reply_to=email['Message-Id'])
     parse_mail(email2)
Esempio n. 15
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment + '\n' + self.orig_patch)
     del email['Content-Type']
     del email['Content-Transfer-Encoding']
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 16
0
 def setUp(self):
     self.patch = read_patch(self.patch_filename)
     self.user = create_user()
     self.p1 = Project(linkname='test-project-1',
                       name='Project 1',
                       listid='1.example.com',
                       listemail='*****@*****.**')
     self.p1.save()
Esempio n. 17
0
 def setUp(self):
     self.patch = read_patch(self.patch_filename)
     self.user = create_user()
     self.p1 = Project(linkname = 'test-project-1', name = 'Project 1',
             listid = '1.example.com', listemail='*****@*****.**')
     self.p1.save()
     self.default_state = get_default_initial_patch_state()
     self.nondefault_state = State.objects.get(name="Accepted")
Esempio n. 18
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment, multipart = True)
     attachment = MIMEText(self.orig_patch, _subtype = self.content_subtype)
     email.attach(attachment)
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 19
0
 def setUp(self):
     project = defaults.project
     project.listid = 'test.example.com'
     project.save()
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment + '\n' + self.orig_patch,
                          project=project)
     email['Message-Id'] = '<*****@*****.**>'
     parse_mail(email)
Esempio n. 20
0
 def setUp(self):
     project = create_project(listid='test.example.com')
     self.orig_diff = read_patch(self.patch_filename)
     email = create_email(self.orig_diff,
                          listid=project.listid)
     parse_mail(email)
     email2 = create_email(self.comment_content,
                           in_reply_to=email['Message-Id'])
     parse_mail(email2)
Esempio n. 21
0
class UTF8InlinePatchTest(InlinePatchTest):

    orig_diff = read_patch('0002-utf-8.patch', 'utf-8')

    def setUp(self):
        msg = MIMEText(self.orig_content + '\n' + self.orig_diff,
                       _charset='utf-8')
        email = _create_email(msg)

        self.diff, self.content = find_content(email)
Esempio n. 22
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email( \
             self.test_comment + '\n' + \
             '_______________________________________________\n' + \
             'Linuxppc-dev mailing list\n' + \
             self.orig_patch)
     content = find_content(self.project, email)
     self.patch = content.patch
     self.comment = content.comment
Esempio n. 23
0
 def setUp(self):
     defaults.project.save()
     defaults.patch_author_person.save()
     self.patch_content = read_patch(self.patch_filename,
             encoding = self.patch_encoding)
     self.patch = Patch(project = defaults.project,
                        msgid = 'x', name = defaults.patch_name,
                        submitter = defaults.patch_author_person,
                        content = self.patch_content)
     self.patch.save()
     self.client = Client()
Esempio n. 24
0
    def test_duplicate_comment(self):
        diff = read_patch('0001-add-line.patch')
        m1 = create_email(diff, listid=self.listid, msgid='*****@*****.**')
        _parse_mail(m1)

        m2 = create_email('test', listid=self.listid, msgid='*****@*****.**',
                          in_reply_to='*****@*****.**')
        self._test_duplicate_mail(m2)

        self.assertEqual(Patch.objects.count(), 1)
        self.assertEqual(PatchComment.objects.count(), 1)
Esempio n. 25
0
 def setUp(self):
     defaults.project.save()
     defaults.patch_author_person.save()
     self.patch_content = read_patch(self.patch_filename,
                                     encoding=self.patch_encoding)
     self.patch = Patch(project=defaults.project,
                        msgid='x',
                        name=defaults.patch_name,
                        submitter=defaults.patch_author_person,
                        content=self.patch_content)
     self.patch.save()
     self.client = Client()
Esempio n. 26
0
    def test_patch_comment(self):
        body = read_patch('0001-add-line.patch')
        patch_email = create_email(body, listid=self.project.listid)
        comment_a_msgid, comment_b_msgid = \
            self._create_submission_and_comments(patch_email)

        self.assertEqual(1, Patch.objects.count())
        self.assertEqual(2, PatchComment.objects.count())
        comment_a = PatchComment.objects.get(msgid=comment_a_msgid)
        self.assertIsNone(comment_a.addressed)
        comment_b = PatchComment.objects.get(msgid=comment_b_msgid)
        self.assertFalse(comment_b.addressed)
Esempio n. 27
0
    def setUp(self):
        self.p1 = create_project()
        self.p2 = create_project()

        patch = read_patch(self.patch_filename)
        email = create_email(content=''.join([self.orig_content, '\n', patch]),
                             msgid=self.msgid,
                             listid='<%s>' % self.p1.listid)
        parse_mail(email)

        del email['List-ID']
        email['List-ID'] = '<%s>' % self.p2.listid
        parse_mail(email)
Esempio n. 28
0
class InlinePatchTest(PatchTest):

    orig_content = 'Test for attached patch'
    orig_diff = read_patch('0001-add-line.patch')

    def setUp(self):
        email = create_email(self.orig_content + '\n' + self.orig_diff)
        self.diff, self.content = find_content(email)

    def test_patch_content(self):
        self.assertEqual(self.diff, self.orig_diff)

    def test_patch_diff(self):
        self.assertEqual(self.content, self.orig_content)
Esempio n. 29
0
    def setUp(self):
        self.p1 = create_project()
        self.p2 = create_project()

        patch = read_patch(self.patch_filename)
        email = create_email(
            content=''.join([self.orig_content, '\n', patch]),
            msgid=self.msgid,
            listid='<%s>' % self.p1.listid)
        parse_mail(email)

        del email['List-ID']
        email['List-ID'] = '<%s>' % self.p2.listid
        parse_mail(email)
Esempio n. 30
0
    def setUp(self):
        self.p1 = create_project()
        self.p2 = create_project()

        patch = read_patch(self.patch_filename)
        email = create_email(self.test_content + '\n' + patch)
        del email['Message-Id']
        email['Message-Id'] = self.msgid

        del email['List-ID']
        email['List-ID'] = '<' + self.p1.listid + '>'
        parse_mail(email)

        del email['List-ID']
        email['List-ID'] = '<' + self.p2.listid + '>'
        parse_mail(email)
Esempio n. 31
0
    def setUp(self):
        self.p1 = Project(linkname = 'test-project-1', name = 'Project 1',
                listid = '1.example.com', listemail='*****@*****.**')
        self.p2 = Project(linkname = 'test-project-2', name = 'Project 2',
                listid = '2.example.com', listemail='*****@*****.**')

        self.p1.save()
        self.p2.save()

        patch = read_patch(self.patch_filename)
        email = create_email(self.test_comment + '\n' + patch)
        email['Message-Id'] = self.msgid

        del email['List-ID']
        email['List-ID'] = '<' + self.p1.listid + '>'
        parse_mail(email)

        del email['List-ID']
        email['List-ID'] = '<' + self.p2.listid + '>'
        parse_mail(email)
Esempio n. 32
0
    def setUp(self):
        self.p1 = Project(
            linkname="test-project-1", name="Project 1", listid="1.example.com", listemail="*****@*****.**"
        )
        self.p2 = Project(
            linkname="test-project-2", name="Project 2", listid="2.example.com", listemail="*****@*****.**"
        )

        self.p1.save()
        self.p2.save()

        patch = read_patch(self.patch_filename)
        email = create_email(self.test_comment + "\n" + patch)
        email["Message-Id"] = self.msgid

        del email["List-ID"]
        email["List-ID"] = "<" + self.p1.listid + ">"
        parse_mail(email)

        del email["List-ID"]
        email["List-ID"] = "<" + self.p2.listid + ">"
        parse_mail(email)
Esempio n. 33
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(
         self.test_content + '\n' +
         '-- \nsig\n' + self.orig_patch)
     self.patch, _, self.filenames = find_content(self.project, email)
Esempio n. 34
0
 def setUp(self):
     project = create_project(listid='test.example.com')
     self.orig_diff = read_patch(self.patch_filename)
     email = create_email(self.orig_content + '\n' + self.orig_diff,
                          listid=project.listid)
     parse_mail(email)
Esempio n. 35
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_content + '\n' + self.orig_patch)
     del email['Content-Type']
     del email['Content-Transfer-Encoding']
     self.diff, self.message = find_content(self.project, email)
Esempio n. 36
0
 def setUp(self):
     self.patch = read_patch(self.patch_filename)
     self.user = create_user()
     self.project = create_project()
Esempio n. 37
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment + '\n' + self.orig_patch)
     (self.patch, self.comment) = find_content(self.project, email)
Esempio n. 38
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename)
     email = create_email(self.test_comment + "\n" + self.orig_patch)
     del email["Content-Type"]
     del email["Content-Transfer-Encoding"]
     (self.patch, self.comment) = find_content(self.project, email)
Esempio n. 39
0
 def setUp(self):
     project = create_project(listid='test.example.com')
     self.orig_diff = read_patch(self.patch_filename)
     email = create_email(self.orig_content + '\n' + self.orig_diff,
                          listid=project.listid)
     parse_mail(email)
Esempio n. 40
0
 def setUp(self):
     author = create_person(name=u'P\xe4tch Author')
     patch_content = read_patch('0002-utf-8.patch', encoding='utf-8')
     self.patch = create_patch(submitter=author, diff=patch_content)
Esempio n. 41
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename, self.patch_encoding)
     email = create_email(self.test_comment + "\n" + self.orig_patch, content_encoding=self.patch_encoding)
     (self.patch, self.comment) = find_content(self.project, email)
Esempio n. 42
0
 def setUp(self):
     patch_content = read_patch('0002-utf-8.patch', encoding='utf-8')
     self.patch = create_patch(diff=patch_content)
Esempio n. 43
0
 def setUp(self):
     self.patch = read_patch(self.patch_filename)
     self.user = create_user()
     self.project = create_project()
     self.default_state = get_default_initial_patch_state()
     self.nondefault_state = State.objects.get(name="Accepted")
Esempio n. 44
0
 def setUp(self):
     self.orig_patch = read_patch(self.patch_filename, self.patch_encoding)
     email = create_email(self.test_content + '\n' + self.orig_patch,
                          content_encoding=self.patch_encoding)
     self.diff, self.message = find_content(self.project, email)
Esempio n. 45
0
 def setUp(self):
     author = create_person(name=u'P\xe4tch Author')
     patch_content = read_patch('0002-utf-8.patch', encoding='utf-8')
     self.patch = create_patch(submitter=author, diff=patch_content)
Esempio n. 46
0
 def setUp(self):
     self.patch = read_patch(self.patch_filename)
     self.user = create_user()
     self.p1 = Project(linkname='test-project-1', name='Project 1',
                       listid='1.example.com', listemail='*****@*****.**')
     self.p1.save()
Esempio n. 47
0
 def setUp(self):
     self.patch = read_patch(self.patch_filename)
     self.user = create_user()
     self.project = create_project()
Esempio n. 48
0
 def setUp(self):
     patch_content = read_patch('0002-utf-8.patch', encoding='utf-8')
     self.patch = create_patch(diff=patch_content)