def test_recent(self):
     '''
     Test fetching recent bugs.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/buglist.cgi',
         body=open(os.path.join(TEST_DATA, 'bug-list.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     recent = bugzilla.get_recent_bugs(datetime.datetime.now())
     self.assertEqual(
         recent,
         [
             847050,
             846768,
             846835,
             776687,
             843652,
             844761,
             845986,
             790286,
             846953,
             789222,
             844953
         ]
     )
 def test_recent(self):
     '''
     Test fetching recent bugs.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/buglist.cgi',
         body=open(os.path.join(TEST_DATA, 'bug-list.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     recent = bugzilla.get_recent_bugs(datetime.datetime.now())
     self.assertEqual(
         recent,
         [
             847050,
             846768,
             846835,
             776687,
             843652,
             844761,
             845986,
             790286,
             846953,
             789222,
             844953
         ]
     )
 def test_get_bug(self):
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=81873',
         body=open(os.path.join(TEST_DATA, 'bug-81873.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     bug = bugzilla.get_bug(81873)
     self.assertEqual(bug.bug_id, '81873')
     self.assertTrue(bug.has_nonempty('classification'))
 def _load_update_form(self):
     self.httpretty_login()
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?id=872984',
         body=open(os.path.join(TEST_DATA, 'bug-872984.html')).read(),
         content_type="text/html",
     )
     bugzilla = Bugzilla('test', 'test', transport='urllib3')
     bugzilla.load_update_form(872984)
     return bugzilla
 def test_get_bug(self):
     '''
     Test getting existing bug.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=81873',
         body=open(os.path.join(TEST_DATA, 'bug-81873.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     bug = bugzilla.get_bug(81873)
     self.assertEqual(bug.bug_id, '81873')
     self.assertTrue(bug.has_nonempty('classification'))
 def test_get_bug(self):
     """
     Test getting existing bug.
     """
     httpretty.register_uri(
         httpretty.POST,
         "https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=81873",
         body=open(os.path.join(TEST_DATA, "bug-81873.xml")).read(),
     )
     bugzilla = Bugzilla("", "")
     bug = bugzilla.get_bug(81873)
     self.assertEqual(bug.bug_id, "81873")
     self.assertTrue(bug.has_nonempty("classification"))
Beispiel #7
0
 def test_get_multiple_flag_bug(self):
     '''
     Test that multiple flags can be handled as well.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=',
         body=open(os.path.join(TEST_DATA, 'bug-81871.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     bug = bugzilla.get_bug(81871)
     self.assertEqual(bug.bug_id, '81871')
     self.assertTrue(bug.has_nonempty('flags'))
     self.assertEqual(len(bug.flags), 2)
 def test_get_multiple_flag_bug(self):
     '''
     Test that multiple flags can be handled as well.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=',
         body=open(os.path.join(TEST_DATA, 'bug-81871.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     bug = bugzilla.get_bug(81871)
     self.assertEqual(bug.bug_id, '81871')
     self.assertTrue(bug.has_nonempty('flags'))
     self.assertEqual(len(bug.flags), 2)
 def test_get_multiple_flag_bug(self):
     """
     Test that multiple flags can be handled as well.
     """
     httpretty.register_uri(
         httpretty.POST,
         "https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=",
         body=open(os.path.join(TEST_DATA, "bug-81871.xml")).read(),
     )
     bugzilla = Bugzilla("", "")
     bug = bugzilla.get_bug(81871)
     self.assertEqual(bug.bug_id, "81871")
     self.assertTrue(bug.has_nonempty("flags"))
     self.assertEqual(len(bug.flags), 2)
Beispiel #10
0
 def test_get_flag_bug(self):
     '''
     Test that the bugzilla-flag are parsed as well.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=',
         body=open(os.path.join(TEST_DATA, 'bug-81872.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     bug = bugzilla.get_bug(81872)
     self.assertEqual(bug.bug_id, '81872')
     self.assertTrue(bug.has_nonempty('flags'))
     flag = bug.flags[0]
     self.assertEqual(flag['name'], 'needinfo')
 def test_get_flag_bug(self):
     '''
     Test that the bugzilla-flag are parsed as well.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=',
         body=open(os.path.join(TEST_DATA, 'bug-81872.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     bug = bugzilla.get_bug(81872)
     self.assertEqual(bug.bug_id, '81872')
     self.assertTrue(bug.has_nonempty('flags'))
     flag = bug.flags[0]
     self.assertEqual(flag['name'], 'needinfo')
 def test_get_flag_bug(self):
     """
     Test that the bugzilla-flag are parsed as well.
     """
     httpretty.register_uri(
         httpretty.POST,
         "https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=",
         body=open(os.path.join(TEST_DATA, "bug-81872.xml")).read(),
     )
     bugzilla = Bugzilla("", "")
     bug = bugzilla.get_bug(81872)
     self.assertEqual(bug.bug_id, "81872")
     self.assertTrue(bug.has_nonempty("flags"))
     flag = bug.flags[0]
     self.assertEqual(flag["name"], "needinfo")
 def test_login(self):
     '''
     Test login to novell bugzilla.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/index.cgi',
     )
     bugzilla = Bugzilla('', '')
     self.assertRaises(BugzillaLoginFailed, bugzilla.login)
 def test_get_nonexisting_bug(self):
     '''
     Test getting non existing bug.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=20000000',
         body=open(os.path.join(TEST_DATA, 'bug-20000000.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     self.assertRaises(BugzillaNotFound, bugzilla.get_bug, 20000000)
 def test_get_private_bug(self):
     '''
     Test getting private bug.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=582198',
         body=open(os.path.join(TEST_DATA, 'bug-582198.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     self.assertRaises(BugzillaNotPermitted, bugzilla.get_bug, 582198)
 def test_get_invalid_bug(self):
     '''
     Test getting bug with invalid ID.
     '''
     httpretty.register_uri(
         httpretty.POST,
         'https://bugzilla.novell.com/show_bug.cgi?ctype=xml&id=none',
         body=open(os.path.join(TEST_DATA, 'bug-none.xml')).read(),
     )
     bugzilla = Bugzilla('', '')
     self.assertRaises(BugzillaInvalidBugId, bugzilla.get_bug, 'none')