def test_sanity_check(self): t = MasherThread(u'F17', u'testing', [u'bodhi-2.0-1.fc17'], log, self.db_factory, self.tempdir) t.id = 'f17-updates-testing' t.init_path() # test without any arches try: t.sanity_check_repo() assert False, "Sanity check didn't fail with empty dir" except: pass # test with valid repodata for arch in ('i386', 'x86_64', 'armhfp'): repo = os.path.join(t.path, t.id, arch) os.makedirs(repo) mkmetadatadir(repo) t.sanity_check_repo() # test with truncated/busted repodata xml = os.path.join(t.path, t.id, 'i386', 'repodata', 'repomd.xml') repomd = open(xml).read() with open(xml, 'w') as f: f.write(repomd[:-10]) from bodhi.exceptions import RepodataException try: t.sanity_check_repo() assert False, 'Busted metadata passed' except RepodataException: pass
def test_sanity_check(self): t = MasherThread(u"F17", u"testing", [u"bodhi-2.0-1.fc17"], log, self.db_factory, self.tempdir) t.id = "f17-updates-testing" t.init_path() # test without any arches try: t.sanity_check_repo() assert False, "Sanity check didn't fail with empty dir" except: pass # test with valid repodata for arch in ("i386", "x86_64", "armhfp"): repo = os.path.join(t.path, t.id, arch) os.makedirs(repo) mkmetadatadir(repo) t.sanity_check_repo() # test with truncated/busted repodata xml = os.path.join(t.path, t.id, "i386", "repodata", "repomd.xml") repomd = open(xml).read() with open(xml, "w") as f: f.write(repomd[:-10]) from bodhi.exceptions import RepodataException try: t.sanity_check_repo() assert False, "Busted metadata passed" except RepodataException: pass
def test_stage(self): t = MasherThread(u"F17", u"testing", [u"bodhi-2.0-1.fc17"], log, self.db_factory, self.tempdir) t.id = "f17-updates-testing" t.init_path() t.stage_repo() stage_dir = config.get("mash_stage_dir") link = os.path.join(stage_dir, t.id) self.assertTrue(os.path.islink(link))
def test_stage(self): t = MasherThread(u'F17', u'testing', [u'bodhi-2.0-1.fc17'], log, self.db_factory, self.tempdir) t.id = 'f17-updates-testing' t.init_path() t.stage_repo() stage_dir = config.get('mash_stage_dir') link = os.path.join(stage_dir, t.id) self.assertTrue(os.path.islink(link))
def test_statefile(self): t = MasherThread(u"F17", u"testing", [u"bodhi-2.0-1.fc17"], log, self.db_factory, self.tempdir) t.id = "f17-updates-testing" t.init_state() t.save_state() self.assertTrue(os.path.exists(t.mash_lock)) with file(t.mash_lock) as f: state = json.load(f) try: self.assertEquals(state, {u"updates": [u"bodhi-2.0-1.fc17"], u"completed_repos": []}) finally: t.remove_state()
def test_statefile(self): t = MasherThread(u'F17', u'testing', [u'bodhi-2.0-1.fc17'], log, self.db_factory, self.tempdir) t.id = 'f17-updates-testing' t.init_state() t.save_state() self.assertTrue(os.path.exists(t.mash_lock)) with file(t.mash_lock) as f: state = json.load(f) try: self.assertEquals(state, {u'tagged': False, u'updates': [u'bodhi-2.0-1.fc17'], u'completed_repos': []}) finally: t.remove_state()
def test_statefile(self): t = MasherThread(u'F17', u'testing', [u'bodhi-2.0-1.fc17'], log, self.db_factory, self.tempdir) t.id = 'f17-updates-testing' t.init_state() t.save_state() self.assertTrue(os.path.exists(t.mash_lock)) with file(t.mash_lock) as f: state = json.load(f) try: self.assertEquals(state, {u'updates': [u'bodhi-2.0-1.fc17'], u'completed_repos': []}) finally: t.remove_state()