class BugzillaTests(unittest.TestCase): def __init__(self, methodName='runTest'): unittest.TestCase.__init__(self, methodName) self.bug = ReviewBug(TEST_BUG) def setUp(self): if not os.path.exists(TEST_WORK_DIR): os.makedirs(TEST_WORK_DIR) self.bug.set_work_dir(TEST_WORK_DIR) def test_find_urls(self): ''' Test that we can get the urls from a bugzilla report''' rc = self.bug.find_urls() self.assertTrue(rc) self.assertEqual(self.bug.srpm_url, 'http://timlau.fedorapeople.org/files/test/review-test/python-test-1.0-1.fc14.src.rpm') self.assertEqual(self.bug.spec_url, 'http://timlau.fedorapeople.org/files/test/review-test/python-test.spec') def test_download_files(self): ''' Test that we can download the spec and srpm from a bugzilla report''' # download files rc = self.bug.download_files() self.assertTrue(rc) print("SRPM : %s " % self.bug.srpm_file) print("SPEC : %s " % self.bug.spec_file) # check the downloaded files locations srpm = TEST_WORK_DIR + 'python-test-1.0-1.fc14.src.rpm' spec = TEST_WORK_DIR + 'python-test.spec' self.assertEqual(self.bug.srpm_file, srpm) self.assertEqual(self.bug.spec_file, spec) # check that the downloaded files exists self.assertTrue(os.path.exists(srpm)) self.assertTrue(os.path.exists(spec)) def test_login(self): ''' test login to bugzilla You need to use BZ_USER=<user> BZ_PASS=<password> make test to active the login test ''' # Test failed login rc = self.bug.login(user='******', password='******') self.assertEqual(rc,False) if 'BZ_USER' in os.environ and 'BZ_PASS' in os.environ: user = os.environ['BZ_USER'] password = os.environ['BZ_PASS'] rc = self.bug.login(user=user, password=password) self.assertEqual(rc, True)
def __init__(self, methodName='runTest'): unittest.TestCase.__init__(self, methodName) self.bug = ReviewBug(TEST_BUG)