def test_cache(self): def get_mtime(pattern): pattern = os.path.join(ReviewDirs.root, pattern) path = glob(pattern)[0] return os.stat(path).st_mtime self.init_test(["fedora-review", "-b", "818805"]) if os.path.exists("818805-openerp-client"): shutil.rmtree("818805-openerp-client") bug = BugzillaBug(Settings.bug) bug.find_urls() bug.download_files() srpm_org_time = get_mtime("srpm/python-test-1.0*.src.rpm") spec = SpecFile(bug.spec_file) sources = Sources(spec) upstream_org_time = get_mtime("upstream/python-test*.gz") del bug self.init_test(["fedora-review", "-cb", "818805"]) bug = BugzillaBug(Settings.bug) bug.find_urls() bug.download_files() srpm_new_time = get_mtime("srpm/python-test-1.0*.src.rpm") spec = SpecFile(bug.spec_file) sources = Sources(spec) upstream_new_time = get_mtime("upstream/python-test*.gz") self.assertEqual(upstream_org_time, upstream_new_time, "upstream") self.assertEqual(srpm_org_time, srpm_new_time, "srpm")
def test_cache(self): def get_mtime(pattern): pattern = os.path.join(ReviewDirs.root, pattern) path = glob(pattern)[0] return os.stat(path).st_mtime self.init_test(['fedora-review','-b','818805']) if os.path.exists('818805-openerp-client'): shutil.rmtree('818805-openerp-client') bug = BugzillaBug(Settings.bug) bug.find_urls() bug.download_files() srpm_org_time = get_mtime('srpm/python-test-1.0*.src.rpm') spec = SpecFile(bug.spec_file) sources = Sources(spec) upstream_org_time = get_mtime('upstream/python-test*.gz') del bug self.init_test(['fedora-review','-cb','818805']) bug = BugzillaBug(Settings.bug) bug.find_urls() bug.download_files() srpm_new_time = get_mtime('srpm/python-test-1.0*.src.rpm') spec = SpecFile(bug.spec_file) sources = Sources(spec) upstream_new_time = get_mtime('upstream/python-test*.gz') self.assertEqual(upstream_org_time, upstream_new_time, 'upstream') self.assertEqual(srpm_org_time, srpm_new_time, 'srpm')
class TestBugzilla(unittest.TestCase): def setUp(self): sys.argv = ['test-bugzilla','-b',TEST_BUG ] Settings.init(TEST_BUG ) ReviewDirs.workdir_setup('.', True) self.bug = BugzillaBug(TEST_BUG) @unittest.skipIf(no_net, 'No network available') def test_find_urls(self): ''' Test that we can get the urls from a bugzilla report''' rc = self.bug.find_urls() self.assertTrue(rc) home = 'http://timlau.fedorapeople.org/files/test/review-test' self.assertEqual(self.bug.srpm_url, os.path.join(home, 'python-test-1.0-1.fc14.src.rpm')) self.assertEqual(self.bug.spec_url, os.path.join(home, 'python-test.spec')) @unittest.skipIf(no_net, 'No network available') def test_download_files(self): ''' Test that we can download the spec and srpm from a bugzilla report ''' self.bug.find_urls() rc = self.bug.download_files() 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') cd = os.path.abspath('./srpm') srpm = os.path.join(cd, 'python-test-1.0-1.fc14.src.rpm') spec = os.path.join(cd, 'python-test.spec') self.assertEqual(self.bug.srpm_file, srpm) self.assertEqual(self.bug.spec_file, spec) self.assertTrue(os.path.exists(srpm)) self.assertTrue(os.path.exists(spec)) @unittest.skipIf(no_net, 'No network available') 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 with self.assertRaises(SettingsError): rc = self.bug.login('dummmy', 'dummy') 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 test_bugzilla_bug(self): self.init_test('test_misc', argv=['-b','817268'], wd='python-test') bug = BugzillaBug('817268') bug.find_urls() expected ='http://dl.dropbox.com/u/17870887/python-faces-0.11.7-2' \ '/python-faces-0.11.7-2.fc16.src.rpm' self.assertEqual(expected, bug.srpm_url) expected = 'http://dl.dropbox.com/u/17870887/python-faces-0.11.7-2/' \ 'python-faces.spec' self.assertEqual(expected, bug.spec_url) self.assertEqual(None, bug.spec_file) self.assertEqual(None, bug.srpm_file)
def test_bugzilla_bug(self): sys.argv = ['fedora-review','-b','817268'] Settings.init(True) ReviewDirs.reset() ReviewDirs.workdir_setup('.', True) bug = BugzillaBug('817268') bug.find_urls() expected ='http://dl.dropbox.com/u/17870887/python-faces-0.11.7-2' \ '/python-faces-0.11.7-2.fc16.src.rpm' self.assertEqual(expected, bug.srpm_url) expected = 'http://dl.dropbox.com/u/17870887/python-faces-0.11.7-2/' \ 'python-faces.spec' self.assertEqual(expected, bug.spec_url) self.assertEqual(None, bug.spec_file) self.assertEqual(None, bug.srpm_file) os.chdir(self.startdir)
def test_bugzilla_bug(self): sys.argv = ['fedora-review', '-b', '817268'] Settings.init(True) ReviewDirs.reset() ReviewDirs.workdir_setup('.', True) bug = BugzillaBug('817268') bug.find_urls() expected ='http://dl.dropbox.com/u/17870887/python-faces-0.11.7-2' \ '/python-faces-0.11.7-2.fc16.src.rpm' self.assertEqual(expected, bug.srpm_url) expected = 'http://dl.dropbox.com/u/17870887/python-faces-0.11.7-2/' \ 'python-faces.spec' self.assertEqual(expected, bug.spec_url) self.assertEqual(None, bug.spec_file) self.assertEqual(None, bug.srpm_file) os.chdir(self.startdir)
def test_bug(self): """ Test -bug option """ self.init_test(["fedora-review", "-b", "818805"]) bug = BugzillaBug(Settings.bug) bug.find_urls() home = "http://leamas.fedorapeople.org/openerp-client" expected = os.path.join(home, "openerp-client-6.1-2.fc16.src.rpm") self.assertEqual(expected, bug.srpm_url) expected = os.path.join(home, "openerp-client.spec") self.assertEqual(expected, bug.spec_url), bug.download_files() expected = os.path.abspath("srpm/openerp-client-6.1-2.fc16.src.rpm") self.assertEqual(expected, bug.srpm_file), expected = os.path.abspath("srpm/openerp-client.spec") self.assertEqual(expected, bug.spec_file)
class TestBugzilla(FR_TestCase): TEST_BUG = '672280' @unittest.skipIf(NO_NET, 'No network available') def test_find_urls(self): self.init_test('bugzilla', argv=['-b', self.TEST_BUG], wd='python-test') self.bug = BugzillaBug(self.TEST_BUG) ''' Test that we can get the urls from a bugzilla report''' rc = self.bug.find_urls() self.assertTrue(rc) home = 'http://timlau.fedorapeople.org/files/test/review-test' self.assertEqual(self.bug.srpm_url, os.path.join(home, 'python-test-1.0-1.fc14.src.rpm')) self.assertEqual(self.bug.spec_url, os.path.join(home, 'python-test.spec')) @unittest.skipIf(NO_NET, 'No network available') def test_download_files(self): self.init_test('bugzilla', argv=['-b', self.TEST_BUG], wd='python-test') self.bug = BugzillaBug(self.TEST_BUG) ''' Test that we can download the spec and srpm from a bugzilla report ''' self.bug.find_urls() rc = self.bug.download_files() 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') cd = os.path.abspath('./srpm') srpm = os.path.join(cd, 'python-test-1.0-1.fc14.src.rpm') spec = os.path.join(cd, 'python-test.spec') self.assertEqual(self.bug.srpm_file, srpm) self.assertEqual(self.bug.spec_file, spec) self.assertTrue(os.path.exists(srpm)) self.assertTrue(os.path.exists(spec))
def test_bug(self): """ Test -bug option """ self.init_test(['fedora-review','-b','818805']) bug = BugzillaBug(Settings.bug) bug.find_urls() home = 'http://leamas.fedorapeople.org/openerp-client' expected = os.path.join( home, 'openerp-client-6.1-2.fc16.src.rpm') self.assertEqual(expected, bug.srpm_url) expected = os.path.join(home, 'openerp-client.spec') self.assertEqual(expected, bug.spec_url), bug.download_files() expected = os.path.abspath( 'srpm/openerp-client-6.1-2.fc16.src.rpm') self.assertEqual(expected, bug.srpm_file), expected = os.path.abspath('srpm/openerp-client.spec') self.assertEqual(expected, bug.spec_file)