Example #1
0
 def testSetUpEmailSubjectMsg(self):
     bh = BugHunter(self._GetDefaultOption(False))
     subject, content = bh._SetUpEmailSubjectMsg(self._GetIssue(1))
     self.assertEquals(subject, 'BugHunter found 1 query title bug!')
     self.assertEquals(
         content, ('<a href="http://code.google.com/p/chromium/issues/'
                   'list?can=2&colspec=ID+Pri+Mstone+ReleaseBlock+Area+'
                   'Feature+Status+Owner+Summary&cells=tiles&sort=-id&'
                   'q=steps">Used Query</a>: steps<br><br>The number of '
                   'issues : 1<br><ul><li><a href="http://crbug.com/0">0 '
                   'title</a> [] </li></ul>'))
 def testSetUpEmailSubjectMsg(self):
   bh = BugHunter(self._GetDefaultOption(False))
   subject, content = bh._SetUpEmailSubjectMsg(self._GetIssue(1))
   self.assertEquals(subject,
                     'BugHunter found 1 query title bug!')
   self.assertEquals(content,
                     ('<a href="http://code.google.com/p/chromium/issues/'
                      'list?can=2&colspec=ID+Pri+Mstone+ReleaseBlock+Area+'
                      'Feature+Status+Owner+Summary&cells=tiles&sort=-id&'
                      'q=steps">Used Query</a>: steps<br><br>The number of '
                      'issues : 1<br><ul><li><a href="http://crbug.com/0">0 '
                      'title</a> [] </li></ul>'))
Example #3
0
 def testGetIssuesWithMockClient(self):
     bh = BugHunter(self._GetDefaultOption(False, query=('dummy')))
     expected_issues = [{
         'issue_id': '0',
         'title': 'title',
         'author': 'author',
         'status': 'Unconfirmed',
         'state': 'open',
         'content': 'http://www.content.com',
         'comments': '',
         'labels': ['label1'],
         'urls': ['http://www.content.com']
     }]
     self.assertEquals(expected_issues, bh.GetIssues())
Example #4
0
    def testWriteIssuesToFileInCSV(self):
        ops = self._GetDefaultOption(False)
        bh = BugHunter(ops)
        bh.WriteIssuesToFileInCSV(self._GetIssue(), self._TEST_FILENAME)

        with open(self._TEST_FILENAME, 'r') as f:
            reader = csv.reader(f)
            self.assertEquals(reader.next(), [
                'status', 'content', 'state', 'issue_id', 'urls', 'title',
                'labels', 'author', 'comments'
            ])
            self.assertEquals(reader.next(), [
                'status', 'content', 'state', '0', '[]', 'title', '[]',
                'author', '[]'
            ])
            self.assertRaises(StopIteration, reader.next)
Example #5
0
 def testGetComments(self):
     comments = BugHunter(self._GetDefaultOption(False)).GetComments(
         100000, 2)
     self.assertEquals(len(comments), 2)
     expected_comments = [
         (None, '*****@*****.**', '2011-10-31T19:54:40.000Z'),
         (None, '*****@*****.**', '2011-10-14T13:59:37.000Z')
     ]
     self.assertEquals(comments, expected_comments)
Example #6
0
 def testSetUpEmailSubjectMsgWith10DaysAgoAndAssertSubject(self):
     bh = BugHunter(self._GetDefaultOption(True))
     subject, _ = bh._SetUpEmailSubjectMsg(self._GetIssue(1))
     self.assertEquals(subject,
                       ('BugHunter found 1 query title bug in the past 10 '
                        'days!'))
Example #7
0
 def testSetUpEmailSubjectMsgMultipleIssues(self):
     bh = BugHunter(self._GetDefaultOption(False))
     subject, content = bh._SetUpEmailSubjectMsg(self._GetIssue(2))
     self.assertEquals(subject, 'BugHunter found 2 query title bugs!')
 def testSetUpEmailSubjectMsgWith10DaysAgoAndAssertSubject(self):
   bh = BugHunter(self._GetDefaultOption(True))
   subject, _ = bh._SetUpEmailSubjectMsg(self._GetIssue(1))
   self.assertEquals(subject,
                     ('BugHunter found 1 query title bug in the past 10 '
                      'days!'))
 def testSetUpEmailSubjectMsgMultipleIssues(self):
   bh = BugHunter(self._GetDefaultOption(False))
   subject, content = bh._SetUpEmailSubjectMsg(self._GetIssue(2))
   self.assertEquals(subject,
                     'BugHunter found 2 query title bugs!')
Example #10
0
 def testGetIssueReturnNoIssue(self):
     ops = self._GetDefaultOption(True)
     ops.query = 'thisshouldnotmatchpleaseignorethis*'
     self.assertFalse(BugHunter(ops).GetIssues())
Example #11
0
 def testGetIssueReturnedIssueWithStatus(self):
     ops = self._GetDefaultOption(False)
     ops.query = 'Feature:Media* Status:Unconfirmed'
     issues = BugHunter(ops).GetIssues()
     for issue in issues:
         self.assertEquals(issue['status'], 'Unconfirmed')
Example #12
0
 def testGetIssueReturnedIssue(self):
     bh = BugHunter(
         self._GetDefaultOption(False,
                                query=('audio opened-after:2010/10/10'
                                       ' opened-before:2010/10/20')))
     self.assertEquals(len(bh.GetIssues()), 18)