def test_get_iso_sha256(self): drp = models.DriverRepoPackage(self.directory) iso = drp.get_iso() fh = open(iso.get_loc()) truth_sha256 = utils.checksum_for_file(fh, 'sha256') fh.close() assert_equal(truth_sha256, iso.get_sha256())
def test_verify_driver_versions(self): drp = models.DriverRepoPackage(self.directory) drpms_all, _ = drp.get_rpms() driver_rpms = [rpm for rpm in drpms_all if rpm.get_kernel() == 'xen'] assert len(driver_rpms) == len(self.sample_data['drivers'].keys()) for driver_rpm in driver_rpms: driver_name = driver_rpm.get_name() assert driver_name in self.sample_data['drivers'].keys() assert_equal(driver_rpm.get_version(), self.sample_data['drivers'][driver_name])
def setUp(self): self.directory = utils.create_temp_directory("test-directory") json_file_loc = "%s/%s" % (os.path.dirname(os.path.realpath(__file__)), self.JSON_FILE) fh = open(json_file_loc, 'r') json_data = fh.read() fh.close() utils.create_file(self.directory, "sample-1.0.json", data=json_data) self.drp = models.DriverRepoPackage(self.directory)
def test_verify_rpm_names(self): drp = models.DriverRepoPackage(self.directory) driver_rpms, userspace_rpms = drp.get_rpms() # Define truth list rpm_names = [os.path.basename(rpm.split().pop()) for rpm in self.sample_data['rpmdata']] for driver_rpm in driver_rpms: assert_in(driver_rpm.get_filename(), rpm_names) for userspace_rpm in userspace_rpms: assert_in(userspace_rpm.get_filename(), rpm_names) # Check the total number of rpms is correct assert len(driver_rpms) + len(userspace_rpms) == len(rpm_names)
def test_get_metadata_md5(self): drp = models.DriverRepoPackage(self.directory) metadata_md5 = drp.get_metadata_file().get_contents() assert_equal(self.sample_data['metadata_md5'], metadata_md5)
def test_get_zip(self): drp = models.DriverRepoPackage(self.directory) zip_file = drp.get_zip() assert_equal(self.sample_data['zip'], zip_file.get_filename())
def test_get_iso_name(self): drp = models.DriverRepoPackage(self.directory) iso = drp.get_iso() assert_equal(self.sample_data['iso'], iso.get_filename())
def test_get_kernel_version(self): drp = models.DriverRepoPackage(self.directory) kernel_ver = drp.get_kernel_version() assert_equal(self.sample_data['kernel_version'], kernel_ver)