コード例 #1
0
ファイル: test_projects.py プロジェクト: daxtens/patchwork
    def test_no_redirect(self):
        utils.create_project()
        utils.create_project()

        requested_url = reverse('project-list')

        response = self.client.get(requested_url)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response.context['projects']), 2)
コード例 #2
0
ファイル: test_projects.py プロジェクト: Aleks1966/patchwork
    def test_no_redirect(self):
        utils.create_project()
        utils.create_project()

        requested_url = reverse('project-list')

        response = self.client.get(requested_url)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response.context['projects']), 2)
コード例 #3
0
ファイル: test_project.py プロジェクト: stephenfin/patchwork
    def test_list_version_1_0(self):
        """List projects using API v1.0.

        Validate that newer fields are dropped for older API versions.
        """
        create_project()

        resp = self.client.get(self.api_url(version='1.0'))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertEqual(1, len(resp.data))
        self.assertNotIn('subject_match', resp.data[0])
コード例 #4
0
    def test_list_version_1_0(self):
        """List projects using API v1.0.

        Validate that newer fields are dropped for older API versions.
        """
        create_project()

        resp = self.client.get(self.api_url(version='1.0'))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertEqual(1, len(resp.data))
        self.assertNotIn('subject_match', resp.data[0])
コード例 #5
0
ファイル: test_parser.py プロジェクト: Aleks1966/patchwork
    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)
コード例 #6
0
ファイル: test_parser.py プロジェクト: getpatchwork/patchwork
    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)
コード例 #7
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)
コード例 #8
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)
コード例 #9
0
    def setUp(self):
        email = create_email(self.orig_content + '\n' + self.orig_diff)
        del email['Content-Type']
        del email['Content-Transfer-Encoding']

        self.project = create_project()
        self.diff, self.content = find_content(self.project, email)
コード例 #10
0
    def setUp(self):
        msg = MIMEText(self.orig_content + '\n' + self.orig_diff,
                       _charset='utf-8')
        email = _create_email(msg)

        self.project = create_project()
        self.diff, self.content = find_content(self.project, email)
コード例 #11
0
ファイル: test_parser.py プロジェクト: Aleks1966/patchwork
    def test_nested_series(self):
        """Handle a series sent in-reply-to an existing series."""
        # create an old series with a "cover letter"
        msgids = [make_msgid()]
        project = create_project()
        series_v1 = create_series(project=project)
        create_series_reference(msgid=msgids[0], series=series_v1)

        # ...and three patches
        for i in range(3):
            msgids.append(make_msgid())
            create_series_reference(msgid=msgids[-1], series=series_v1)

        # now create a new series with "cover letter"
        msgids.append(make_msgid())
        series_v2 = create_series(project=project)
        ref_v2 = create_series_reference(msgid=msgids[-1], series=series_v2)

        # ...and the "first patch" of this new series
        msgid = make_msgid()
        email = self._create_email(msgid, msgids)
        series = find_series(project, email, get_or_create_author(email))

        # this should link to the second series - not the first
        self.assertEqual(len(msgids), 4 + 1)  # old series + new cover
        self.assertEqual(series, ref_v2.series)
コード例 #12
0
    def setUp(self):
        self.project = create_project()

        for name, email, date in self.patchmeta:
            person = create_person(name=name, email=email)
            create_patch(submitter=person, project=self.project,
                         date=date)
コード例 #13
0
ファイル: test_parser.py プロジェクト: Aleks1966/patchwork
    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()
コード例 #14
0
ファイル: test_parser.py プロジェクト: eqvinox/patchwork
    def setUp(self):
        email = create_email(self.orig_content + '\n' + self.orig_diff)
        del email['Content-Type']
        del email['Content-Transfer-Encoding']

        self.project = create_project()
        self.diff, self.content = find_content(self.project, email)
コード例 #15
0
    def test_get_by_id(self):
        """Validate that it's possible to filter by pk."""
        project = create_project()

        resp = self.client.get(self.api_url(project.pk))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertSerialized(project, resp.data)
コード例 #16
0
ファイル: test_parser.py プロジェクト: Aleks1966/patchwork
    def test_new_series(self):
        msgid = make_msgid()
        email = self._create_email(msgid)
        project = create_project()

        self.assertIsNone(
            find_series(project, email, get_or_create_author(email)))
コード例 #17
0
ファイル: test_parser.py プロジェクト: getpatchwork/patchwork
    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()
コード例 #18
0
    def test_get_by_linkname(self):
        """Validate that it's possible to filter by linkname."""
        project = create_project(linkname='project', name='Sample project')

        resp = self.client.get(self.api_url('project'))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertSerialized(project, resp.data)
コード例 #19
0
    def test_update(self):
        """Ensure updates can be performed by maintainers."""
        project = create_project()
        data = {'web_url': 'TEST'}

        # an anonymous user
        resp = self.client.patch(self.api_url(project.id), data)
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

        # a normal user
        user = create_user()
        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(project.id), data)
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

        # a maintainer
        user = create_maintainer(project)
        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(project.id), data)
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertEqual(resp.data['web_url'], 'TEST')

        # ...with the exception of some read-only fields
        resp = self.client.patch(self.api_url(project.id),
                                 {'link_name': 'test'})
        # NOTE(stephenfin): This actually returns HTTP 200 due to
        # https://github.com/encode/django-rest-framework/issues/1655
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertNotEqual(resp.data['link_name'], 'test')
コード例 #20
0
ファイル: test_list.py プロジェクト: alialnu/patchwork
    def setUp(self):
        self.project = create_project()

        for name, email, date in self.patchmeta:
            person = create_person(name=name, email=email)
            create_patch(submitter=person, project=self.project,
                         date=date)
コード例 #21
0
ファイル: test_project.py プロジェクト: daxtens/patchwork
    def test_update(self):
        """Ensure updates can be performed by maintainers."""
        project = create_project()
        data = {'web_url': 'TEST'}

        # an anonymous user
        resp = self.client.patch(self.api_url(project.id), data)
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

        # a normal user
        user = create_user()
        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(project.id), data)
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

        # a maintainer
        user = create_maintainer(project)
        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(project.id), data)
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertEqual(resp.data['web_url'], 'TEST')

        # ...with the exception of some read-only fields
        resp = self.client.patch(self.api_url(project.id), {
            'link_name': 'test'})
        # NOTE(stephenfin): This actually returns HTTP 200 due to
        # https://github.com/encode/django-rest-framework/issues/1655
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertNotEqual(resp.data['link_name'], 'test')
コード例 #22
0
ファイル: test_bundles.py プロジェクト: sandy-lcq/patchwork
 def setUp(self, count=3):
     self.user = create_user()
     self.client.login(username=self.user.username,
                       password=self.user.username)
     self.bundle = create_bundle(owner=self.user)
     self.project = create_project()
     self.patches = create_patches(count, project=self.project)
コード例 #23
0
ファイル: test_rest_api.py プロジェクト: seanfarley/patchwork
    def test_get_numeric_linkname(self):
        """Validate we try to do the right thing for numeric linkname"""
        project = create_project(linkname='12345')

        resp = self.client.get(self.api_url('12345'))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertSerialized(project, resp.data)
コード例 #24
0
ファイル: test_patch.py プロジェクト: daxtens/patchwork
    def test_update(self):
        """Ensure updates can be performed by maintainers."""
        project = create_project()
        patch = create_patch(project=project)
        state = create_state()

        # anonymous user
        resp = self.client.patch(self.api_url(patch.id), {'state': state.name})
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

        # authenticated user
        user = create_user()
        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(patch.id), {'state': state.name})
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)

        # maintainer
        user = create_maintainer(project)
        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(patch.id), {
            'state': state.name, 'delegate': user.id})
        self.assertEqual(status.HTTP_200_OK, resp.status_code, resp)
        self.assertEqual(Patch.objects.get(id=patch.id).state, state)
        self.assertEqual(Patch.objects.get(id=patch.id).delegate, user)

        # (who can unset fields too)
        # we need to send as JSON due to https://stackoverflow.com/q/30677216/
        resp = self.client.patch(self.api_url(patch.id), {'delegate': None},
                                 format='json')
        self.assertEqual(status.HTTP_200_OK, resp.status_code, resp)
        self.assertIsNone(Patch.objects.get(id=patch.id).delegate)
コード例 #25
0
ファイル: test_parser.py プロジェクト: alialnu/patchwork
    def test_nested_series(self):
        """Handle a series sent in-reply-to an existing series."""
        # create an old series with a "cover letter"
        msgids = [make_msgid()]
        project = create_project()
        series_v1 = create_series(project=project)
        create_series_reference(msgid=msgids[0], series=series_v1)

        # ...and three patches
        for i in range(3):
            msgids.append(make_msgid())
            create_series_reference(msgid=msgids[-1], series=series_v1)

        # now create a new series with "cover letter"
        msgids.append(make_msgid())
        series_v2 = create_series(project=project)
        ref_v2 = create_series_reference(msgid=msgids[-1], series=series_v2)

        # ...and the "first patch" of this new series
        msgid = make_msgid()
        email = self._create_email(msgid, msgids)
        series = find_series(project, email)

        # this should link to the second series - not the first
        self.assertEqual(len(msgids), 4 + 1)  # old series + new cover
        self.assertEqual(series, ref_v2.series)
コード例 #26
0
ファイル: test_bundles.py プロジェクト: nickglobal/patchwork
 def setUp(self, count=3):
     self.user = create_user()
     self.client.login(username=self.user.username,
                       password=self.user.username)
     self.bundle = create_bundle(owner=self.user)
     self.project = create_project()
     self.patches = create_patches(count, project=self.project)
コード例 #27
0
    def test_update_maintainer(self):
        """Update patch as maintainer.

        Ensure updates can be performed by maintainers.
        """
        project = create_project()
        patch = create_patch(project=project)
        state = create_state()
        user = create_maintainer(project)

        self.client.force_authenticate(user=user)
        resp = self.client.patch(self.api_url(patch.id), {
            'state': state.slug,
            'delegate': user.id
        })
        self.assertEqual(status.HTTP_200_OK, resp.status_code, resp)
        self.assertEqual(Patch.objects.get(id=patch.id).state, state)
        self.assertEqual(Patch.objects.get(id=patch.id).delegate, user)

        # (who can unset fields too)
        # we need to send as JSON due to https://stackoverflow.com/q/30677216/
        resp = self.client.patch(self.api_url(patch.id), {'delegate': None},
                                 format='json')
        self.assertEqual(status.HTTP_200_OK, resp.status_code, resp)
        self.assertIsNone(Patch.objects.get(id=patch.id).delegate)
コード例 #28
0
    def test_mailman_dmarc_munging(self):
        project = create_project()
        real_sender = 'Existing Sender <*****@*****.**>'
        munged_sender = 'Existing Sender via List <{}>'.format(
            project.listemail)
        other_email = 'Other Person <*****@*****.**>'

        # Unmunged author
        mail = self._create_email(real_sender)
        person_a = get_or_create_author(mail, project)
        person_a.save()

        # Single Reply-To
        mail = self._create_email(munged_sender, [real_sender])
        person_b = get_or_create_author(mail, project)
        self.assertEqual(person_b._state.adding, False)
        self.assertEqual(person_b.id, person_a.id)

        # Single Cc
        mail = self._create_email(munged_sender, [], [real_sender])
        person_b = get_or_create_author(mail, project)
        self.assertEqual(person_b._state.adding, False)
        self.assertEqual(person_b.id, person_a.id)

        # Multiple Reply-Tos and Ccs
        mail = self._create_email(munged_sender, [other_email, real_sender],
                                  [other_email, other_email])
        person_b = get_or_create_author(mail, project)
        self.assertEqual(person_b._state.adding, False)
        self.assertEqual(person_b.id, person_a.id)
コード例 #29
0
ファイル: test_rest_api.py プロジェクト: alialnu/patchwork
    def test_get_by_numeric_linkname(self):
        """Validate we try to do the right thing for numeric linkname"""
        project = create_project(linkname='12345')

        resp = self.client.get(self.api_url('12345'))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertSerialized(project, resp.data)
コード例 #30
0
ファイル: test_rest_api.py プロジェクト: alialnu/patchwork
    def test_get_by_id(self):
        """Validate that it's possible to filter by pk."""
        project = create_project()

        resp = self.client.get(self.api_url(project.pk))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertSerialized(project, resp.data)
コード例 #31
0
ファイル: test_parser.py プロジェクト: eqvinox/patchwork
    def setUp(self):
        msg = MIMEText(self.orig_content + '\n' + self.orig_diff,
                       _charset='utf-8')
        email = _create_email(msg)

        self.project = create_project()
        self.diff, self.content = find_content(self.project, email)
コード例 #32
0
ファイル: test_rest_api.py プロジェクト: alialnu/patchwork
    def test_get_by_linkname(self):
        """Validate that it's possible to filter by linkname."""
        project = create_project(linkname='project', name='Sample project')

        resp = self.client.get(self.api_url('project'))
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertSerialized(project, resp.data)
コード例 #33
0
ファイル: test_parser.py プロジェクト: stephenfin/patchwork
    def test_new_series(self):
        msgid = make_msgid()
        email = self._create_email(msgid)
        project = create_project()

        self.assertIsNone(find_series(project, email,
                                      get_or_create_author(email)))
コード例 #34
0
    def test_anonymous_update(self):
        """Ensure anonymous "PATCH" operations are rejected."""
        project = create_project()

        resp = self.client.patch(self.api_url(project.id),
                                 {'linkname': 'foo'})
        self.assertEqual(status.HTTP_403_FORBIDDEN, resp.status_code)
コード例 #35
0
 def setUp(self):
     super(TestCheckAPI, self).setUp()
     project = create_project()
     self.user = create_maintainer(project)
     self.patch = create_patch(project=project)
     self.urlbase = reverse('api_1.0:patch-detail', args=[self.patch.id])
     self.urlbase += 'checks/'
コード例 #36
0
    def _create_patch(self, **kwargs):
        person_obj = create_person(email='*****@*****.**')
        project_obj = create_project(linkname='myproject')
        state_obj = create_state(name='Under Review')
        patch_obj = create_patch(state=state_obj, project=project_obj,
                                 submitter=person_obj, **kwargs)

        return patch_obj
コード例 #37
0
ファイル: test_series.py プロジェクト: stephenfin/patchwork
    def _create_series(self):
        project_obj = create_project(linkname='myproject')
        person_obj = create_person(email='*****@*****.**')
        series_obj = create_series(project=project_obj, submitter=person_obj)
        create_cover(series=series_obj)
        create_patch(series=series_obj)

        return series_obj
コード例 #38
0
ファイル: test_project.py プロジェクト: stephenfin/patchwork
    def test_list_anonymous(self):
        """List projects as anonymous user."""
        project = create_project()

        resp = self.client.get(self.api_url())
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertEqual(1, len(resp.data))
        self.assertSerialized(project, resp.data[0])
コード例 #39
0
    def _create_series(self):
        project_obj = create_project(linkname='myproject')
        person_obj = create_person(email='*****@*****.**')
        series_obj = create_series(project=project_obj, submitter=person_obj)
        create_cover(series=series_obj)
        create_patch(series=series_obj)

        return series_obj
コード例 #40
0
ファイル: test_patch.py プロジェクト: stephenfin/patchwork
    def _create_patch(self, **kwargs):
        person_obj = create_person(email='*****@*****.**')
        project_obj = create_project(linkname='myproject')
        state_obj = create_state(name='Under Review')
        patch_obj = create_patch(state=state_obj, project=project_obj,
                                 submitter=person_obj, **kwargs)

        return patch_obj
コード例 #41
0
ファイル: test_filters.py プロジェクト: eqvinox/patchwork
    def test_utf8_handling(self):
        """Validate handling of non-ascii characters."""
        project = create_project()
        url = reverse('patch-list', args=[project.linkname])

        response = self.client.get(url + '?submitter=%%E2%%98%%83')

        self.assertEqual(response.status_code, 200)
コード例 #42
0
    def test_utf8_handling(self):
        """Validate handling of non-ascii characters."""
        project = create_project()
        url = reverse('patch-list', args=[project.linkname])

        response = self.client.get(url + '?submitter=%%E2%%98%%83')

        self.assertEqual(response.status_code, 200)
コード例 #43
0
    def test_find_cover_for_comment__no_reply(self):
        """Test behavior for mails that don't match anything we have."""
        project = create_project()
        create_cover(project=project)

        result = parser.find_cover_for_comment(project, ['foo'])

        self.assertIsNone(result)
コード例 #44
0
    def test_list_anonymous(self):
        """List projects as anonymous user."""
        project = create_project()

        resp = self.client.get(self.api_url())
        self.assertEqual(status.HTTP_200_OK, resp.status_code)
        self.assertEqual(1, len(resp.data))
        self.assertSerialized(project, resp.data[0])
コード例 #45
0
ファイル: test_parser.py プロジェクト: Aleks1966/patchwork
 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)
コード例 #46
0
 def test_invalid_patch_id(self):
     project = create_project()
     requested_url = reverse(
         'patch-detail',
         kwargs={'project_id': project.linkname, 'msgid': 'foo'},
     )
     response = self.client.get(requested_url)
     self.assertEqual(response.status_code, 404)
コード例 #47
0
ファイル: test_parser.py プロジェクト: eqvinox/patchwork
    def setUp(self):
        email = create_email('\n'.join([
            self.orig_content,
            '_______________________________________________',
            'Linuxppc-dev mailing list',
            self.orig_diff]))

        self.project = create_project()
        self.diff, self.content = find_content(self.project, email)
コード例 #48
0
ファイル: test_bundle.py プロジェクト: stephenfin/patchwork
    def _create_bundles(self):
        user = create_user(username='******')
        project = create_project(linkname='myproject')
        bundle_public = create_bundle(public=True, owner=user,
                                      project=project)
        bundle_private = create_bundle(public=False, owner=user,
                                       project=project)

        return user, project, bundle_public, bundle_private
コード例 #49
0
ファイル: test_management.py プロジェクト: daxtens/patchwork
    def test_utf8_path(self):
        project = utils.create_project()
        utils.create_state()

        path = os.path.join(TEST_MAIL_DIR, '0013-with-utf8-body.mbox')
        call_command('parsemail', infile=path, list_id=project.listid)

        count = models.Patch.objects.filter(project=project.id).count()
        self.assertEqual(count, 1)
コード例 #50
0
ファイル: test_xmlrpc.py プロジェクト: daxtens/patchwork
 def setUp(self):
     self.url = self.live_server_url + reverse('xmlrpc')
     # url is of the form http://localhost:PORT/PATH
     # strip the http and replace it with the username/passwd of a user.
     self.project = utils.create_project()
     self.user = utils.create_maintainer(self.project)
     self.url = ('http://%s:%s@' + self.url[7:]) % (self.user.username,
                                                    self.user.username)
     self.rpc = xmlrpc_client.Server(self.url)
コード例 #51
0
ファイル: test_projects.py プロジェクト: daxtens/patchwork
    def test_redirect(self):
        project = utils.create_project()

        requested_url = reverse('project-list')
        redirect_url = reverse('patch-list', kwargs={
            'project_id': project.linkname})

        response = self.client.get(requested_url)
        self.assertRedirects(response, redirect_url)
コード例 #52
0
ファイル: test_projects.py プロジェクト: Aleks1966/patchwork
    def test_redirect(self):
        project = utils.create_project()

        requested_url = reverse('project-list')
        redirect_url = reverse('patch-list',
                               kwargs={'project_id': project.linkname})

        response = self.client.get(requested_url)
        self.assertRedirects(response, redirect_url)
コード例 #53
0
ファイル: test_xmlrpc.py プロジェクト: talih0/patchwork
 def setUp(self):
     self.url = self.live_server_url + reverse('xmlrpc')
     # url is of the form http://localhost:PORT/PATH
     # strip the http and replace it with the username/passwd of a user.
     self.project = utils.create_project()
     self.user = utils.create_maintainer(self.project)
     self.url = ('http://%s:%s@' + self.url[7:]) % (self.user.username,
                                                    self.user.username)
     self.rpc = xmlrpc_client.Server(self.url)
コード例 #54
0
ファイル: test_parser.py プロジェクト: stephenfin/patchwork
    def setUp(self):
        self.list_id = 'test-subject-match.test.org'
        self.project_x = create_project(name='PROJECT X',
                                        listid=self.list_id,
                                        subject_match=r'.*PROJECT[\s]?X.*')
        self.default_project = create_project(name='Default',
                                              listid=self.list_id,
                                              subject_match=r'')
        self.keyword_project = create_project(name='keyword',
                                              listid=self.list_id,
                                              subject_match=r'keyword')

        self.email = MIMEText('')
        self.email['List-Id'] = self.list_id

        self.email_no_project = MIMEText('')
        self.email_no_project['List-Id'] = 'nonexistent-project.test.org'
        self.email_no_project['Subject'] = '[PATCH keyword]'
コード例 #55
0
ファイル: test_management.py プロジェクト: wangxi11/patchwork
    def test_utf8_path(self):
        project = utils.create_project()
        utils.create_state()

        path = os.path.join(TEST_MAIL_DIR, '0013-with-utf8-body.mbox')
        call_command('parsemail', infile=path, list_id=project.listid)

        count = models.Patch.objects.filter(project=project.id).count()
        self.assertEqual(count, 1)
コード例 #56
0
    def test_find_cover_for_comment__direct_reply(self):
        """Test behavior when we have a reference to the original cover."""
        msgid = make_msgid()
        project = create_project()
        cover = create_cover(msgid=msgid, project=project)

        result = parser.find_cover_for_comment(project, [msgid])

        self.assertEqual(cover, result)
コード例 #57
0
ファイル: test_parser.py プロジェクト: Aleks1966/patchwork
    def setUp(self):
        self.list_id = 'test-subject-match.test.org'
        self.project_x = create_project(name='PROJECT X',
                                        listid=self.list_id,
                                        subject_match=r'.*PROJECT[\s]?X.*')
        self.default_project = create_project(name='Default',
                                              listid=self.list_id,
                                              subject_match=r'')
        self.keyword_project = create_project(name='keyword',
                                              listid=self.list_id,
                                              subject_match=r'keyword')

        self.email = MIMEText('')
        self.email['List-Id'] = self.list_id

        self.email_no_project = MIMEText('')
        self.email_no_project['List-Id'] = 'nonexistent-project.test.org'
        self.email_no_project['Subject'] = '[PATCH keyword]'
コード例 #58
0
ファイル: test_parser.py プロジェクト: alialnu/patchwork
 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)