Exemplo n.º 1
0
    def testSingleTag(self):
        self.project2.subject_prefix_tags = 'i-g-t'
        self.project2.save()

        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH] Subject')
        self.assertEquals(find_project(email), self.project1)
        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH i-g-t] Subject')
        self.assertEquals(find_project(email), self.project2)
Exemplo n.º 2
0
    def testMultipleTags(self):
        self.project2.subject_prefix_tags = 'i-g-t,intel-gpu-tools'
        self.project2.save()

        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH] Subject')
        self.assertEquals(find_project(email), self.project1)
        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH i-g-t] Subject')
        self.assertEquals(find_project(email), self.project2)
        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH intel-gpu-tools] Subject')
        self.assertEquals(find_project(email), self.project2)
Exemplo n.º 3
0
    def testSingleTagInverted(self):
        """To test the order_by()"""
        self.project1.subject_prefix_tags = 'i-g-t'
        self.project1.save()
        self.project2.subject_prefix_tags = ' '
        self.project2.save()

        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH i-g-t] Subject')
        self.assertEquals(find_project(email), self.project1)
        email = create_email(defaults.patch, project=self.project1,
                             subject='[PATCH] Subject')
        self.assertEquals(find_project(email), self.project2)
Exemplo n.º 4
0
 def testShortListId(self):
     """ Some mailing lists have List-Id headers in short formats, where it
         is only the list ID itself (without enclosing angle-brackets). """
     email = MIMEText('')
     email['List-Id'] = self.project.listid
     project = find_project(email)
     self.assertEqual(project, self.project)
    def handle(self, *args, **options):

        if len(args) != 1:
            print('error: Need a project.')
            sys.exit(1)

        try:
            project = Project.objects.get(linkname=args[0])
        except Project.DoesNotExist:
            print("error: can't find project '%s'" % args[0])
            sys.exit(1)

        parser = HeaderParser()
        query = Patch.objects.filter(project=project)
        count = query.count()
        for i, patch in enumerate(query.iterator()):
            if (i % 10) == 0:
                sys.stdout.write("%06d/%06d\r" % (i, count))
                sys.stdout.flush()

            headers = parser.parsestr(patch.headers)
            new_project = find_project(headers)
            if new_project == patch.project:
                continue

            patch.project = new_project
            patch.save()
            series = find_series_for_patch(patch)
            if not series:
                continue
            series.project = new_project
            series.save()

        sys.stdout.write("%06d/%06d\r" % (count, count))
        sys.stdout.write('\ndone\n')
Exemplo n.º 6
0
 def testLongListId(self):
     email = MIMEText('')
     email['List-Id'] = 'Test text <%s>' % self.project.listid
     project = find_project(email)
     self.assertEqual(project, self.project)
Exemplo n.º 7
0
 def testSubstringListId(self):
     email = MIMEText('')
     email['List-Id'] = 'example.com'
     project = find_project(email)
     self.assertEqual(project, None)
Exemplo n.º 8
0
 def testWhitespaceListId(self):
     email = MIMEText('')
     email['List-Id'] = ' '
     project = find_project(email)
     self.assertEqual(project, None)
Exemplo n.º 9
0
 def testNoListId(self):
     email = MIMEText('')
     project = find_project(email)
     self.assertEqual(project, None)
Exemplo n.º 10
0
 def testBlankListId(self):
     email = MIMEText('')
     email['List-Id'] = ''
     project = find_project(email)
     self.assertEquals(project, None)
Exemplo n.º 11
0
 def testBlankListId(self):
     email = MIMEText('')
     email['List-Id'] = ''
     project = find_project(email)
     self.assertEquals(project, None)
Exemplo n.º 12
0
 def testLongListId(self):
     email = MIMEText("")
     email["List-Id"] = "Test text <%s>" % self.project.listid
     project = find_project(email)
     self.assertEquals(project, self.project)
Exemplo n.º 13
0
 def testSubstringListId(self):
     email = MIMEText("")
     email["List-Id"] = "example.com"
     project = find_project(email)
     self.assertEquals(project, None)
Exemplo n.º 14
0
 def testWhitespaceListId(self):
     email = MIMEText("")
     email["List-Id"] = " "
     project = find_project(email)
     self.assertEquals(project, None)