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_Registry(self):
Registry('assa')
def test_flatten(self):
test_arch = self.get_test_loc('repos/hello-world.tar')
test_dir = self.extract_test_tar(test_arch)
expected = os.path.join(self.get_test_loc('repos'), 'hello-world.tar.flatten.expected.json')
reg = Registry()
reg.populate(test_dir)
# ignore the repo_dir and layer_dir that are absolute directories
result = [{name: value for name, value in layer.items() if not name.endswith('dir')}
for layer in reg.flatten()]
check_expected(result, expected, regen=False)
def test_populate(self):
test_arch = self.get_test_loc('repos/imagesv11.tar')
test_dir = self.extract_test_tar(test_arch)
expected = os.path.join(self.get_test_loc('repos'), 'imagesv11.tar.registry.expected.json')
repo = Registry()
repo.populate(test_dir)
# ignore the repo dir by only keeping the values
result = [r.as_dict() for r in repo.repos().values()]
check_expected(result, expected, regen=False)
def test_populate_for_images_with_direct_at_root_layerid_dot_tar_tarball(self):
test_arch = self.get_test_loc('repos/imagesv11_with_tar_at_root.tar')
test_dir = self.extract_test_tar(test_arch)
expected = os.path.join(self.get_test_loc('repos'), 'imagesv11_with_tar_at_root.tar.registry.expected.json')
repo = Registry()
repo.populate(test_dir)
# ignore the repo dir by only keeping the values
result = [r.as_dict() for r in repo.repos().values()]
check_expected(result, expected, regen=False)
def test_populate_hello_world(self):
test_arch = self.get_test_loc('repos/hello-world.tar')
test_dir = self.extract_test_tar(test_arch)
expected = os.path.join(self.get_test_loc('repos'), 'hello-world.tar.registry.expected.json')
repo = Registry()
repo.populate(test_dir)
# ignore the repo dir by only keeping the values
result = [r.as_dict() for r in repo.repos().values()]
check_expected(result, expected, regen=False)