示例#1
0
 def test_container_inspector_single_layer_from_tarball(self):
     test_dir = self.get_test_loc('cli/hello-world.tar')
     expected = self.get_test_loc(
         'cli/hello-world.tar-inventory-from-tarball-expected.json')
     out = cli._container_inspector(image_path=test_dir,
                                    _layer_path_segments=1)
     result = clean_images_data(json.loads(out))
     check_expected(result, expected, regen=False)
示例#2
0
    def test_parse_os_release(self):
        test_dir = self.get_test_loc('distro/chef-os-release/os-release')
        expected_dir = self.get_test_loc('distro/chef-os-release/expected')

        for os_release in listdir(test_dir):
            test_file = path.join(test_dir, os_release)
            expected = path.join(expected_dir, os_release + '-expected.json')
            result = parse_os_release(test_file)
            check_expected(result, expected, regen=False)
示例#3
0
    def test_distro_from_os_release_file(self):
        test_dir = self.get_test_loc('distro/os-release')

        for test_file in resource_iter(test_dir, with_dirs=False):
            if test_file.endswith('-expected.json'):
                continue
            expected = test_file + '-distro-expected.json'
            result = Distro.from_os_release_file(test_file).to_dict()
            check_expected(result, expected, regen=False)
示例#4
0
    def test_distro_from_file(self):
        test_dir = self.get_test_loc('distro/chef-os-release/os-release')
        expected_dir = self.get_test_loc(
            'distro/chef-os-release/expected-distro')

        for os_release in listdir(test_dir):
            test_file = path.join(test_dir, os_release)
            expected = path.join(expected_dir, os_release + '-expected.json')
            result = Distro.from_file(test_file).to_dict()
            check_expected(result, expected, regen=False)