Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_extract_rpm_broken(self):
test_file = self.get_test_loc('archive/rpm/broken.rpm')
test_dir = self.get_temp_dir()
expected = Exception('Unknown extraction error')
self.assertRaisesInstance(expected, archive.extract_rpm,
test_file, test_dir)
def test_extract_rpm_nested_correctly(self):
test_file = self.get_test_loc('archive/rpm/extract_once/libsqueeze0.2_0-0.2.3-8mdv2010.0.i586.rpm')
test_dir = self.get_temp_dir()
archive.extract_rpm(test_file, test_dir)
result = os.path.join(test_dir, 'libsqueeze0.2_0-0.2.3-8mdv2010.0.i586.cpio.lzma')
assert os.path.exists(result)
def test_extract_rpm_basic_2(self):
test_file = self.get_test_loc('archive/rpm/python-glc-0.7.1-1.src.rpm')
test_dir = self.get_temp_dir()
archive.extract_rpm(test_file, test_dir)
result = os.path.join(test_dir, 'python-glc-0.7.1-1.src.cpio.gz')
assert os.path.exists(result)
def test_extract_rpm_with_trailing_data(self):
test_file = self.get_test_loc('archive/rpm/rpm_trailing.rpm')
test_dir = self.get_temp_dir()
result = archive.extract_rpm(test_file, test_dir)
expected = ['elfinfo-1.0-1.fc9.src.cpio.gz']
check_files(test_dir, expected)
assert [] == result
def test_extract_rpm_with_renamed_content(self):
# When the RPM is renamed, we should still be able to find the cpio
test_file = self.get_test_loc('archive/rpm/renamed.rpm')
test_dir = self.get_temp_dir()
result = archive.extract_rpm(test_file, test_dir)
expected = ['python-glc-0.7.1-1.src.cpio.gz']
check_files(test_dir, expected)
assert [] == result
def test_extract_rpm_basic_1(self):
test_file = self.get_test_loc('archive/rpm/elfinfo-1.0-1.fc9.src.rpm')
test_dir = self.get_temp_dir()
archive.extract_rpm(test_file, test_dir)
result = os.path.join(test_dir, 'elfinfo-1.0-1.fc9.src.cpio.gz')
assert os.path.exists(result)