def test_parse_status_file_non_existing_file(self): test_file = os.path.join(self.get_test_loc('debian'), 'foobarbaz') try: list(debian.parse_status_file(test_file)) self.fail('FileNotFoundError not raised') except FileNotFoundError: pass
def test_parse_end_to_end(self): test_dir = self.extract_test_tar('debian/end-to-end.tgz') test_info_dir = os.path.join(test_dir, 'end-to-end') test_file = os.path.join(test_info_dir, 'status') packages = list(debian.parse_status_file(test_file, distro='ubuntu')) assert 1 == len(packages) test_package = packages[0] expected = [ models.PackageFile('/lib/x86_64-linux-gnu/libncurses.so.5.9', md5='23c8a935fa4fc7290d55cc5df3ef56b1'), models.PackageFile('/usr/lib/x86_64-linux-gnu/libform.so.5.9', md5='98b70f283324e89db5787a018a54adf4'), models.PackageFile('/usr/lib/x86_64-linux-gnu/libmenu.so.5.9', md5='e3a0f5154928da2da234920343ac14b2'), models.PackageFile('/usr/lib/x86_64-linux-gnu/libpanel.so.5.9', md5='a927e7d76753bb85f5a784b653d337d2') ] resources = test_package.get_list_of_installed_files(test_info_dir) assert 4 == len(resources) assert expected == resources
def test_parse_status_file_perl_error(self): test_file = self.get_test_loc('debian/mini-status/status') expected_loc = self.get_test_loc('debian/mini-status/status.expected') packages = list(debian.parse_status_file(test_file, distro='debian')) self.check_packages(packages, expected_loc, regen=False)
def test_parse_status_file_basic(self): test_file = self.get_test_loc('debian/basic/status') expected_loc = self.get_test_loc('debian/basic/status.expected') # specify ubuntu distro as this was the source of the test `status` file packages = list(debian.parse_status_file(test_file, distro='ubuntu')) self.check_packages(packages, expected_loc, regen=False)
def test_parse_status_file_not_a_status_file(self): test_file = self.get_test_loc('debian/not-a-status-file') test_packages = list(debian.parse_status_file(test_file)) assert test_packages == []