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_clean_mapping():
dirty_dict = {"a": None, "b": {}, "c": [], "d": 1}
clean_dict = {"b": {}, "c": [], "d": 1}
result = utils.clean_map(dirty_dict)
assert result == clean_dict
async def test_build_from_tar_stream(docker, random_name):
name = "{}:latest".format(random_name())
dockerfile = """
# Shared Volume
FROM python:latest
"""
f = BytesIO(dockerfile.encode("utf-8"))
tar_obj = utils.mktar_from_dockerfile(f)
async for item in docker.images.build(
fileobj=tar_obj, encoding="gzip", tag=name, stream=True
):
pass
tar_obj.close()
image = await docker.images.inspect(name=name)
assert image
async def test_build_from_tar(docker, random_name):
name = "{}:latest".format(random_name())
dockerfile = """
# Shared Volume
FROM python:latest
"""
f = BytesIO(dockerfile.encode("utf-8"))
tar_obj = utils.mktar_from_dockerfile(f)
await docker.images.build(fileobj=tar_obj, encoding="gzip", tag=name)
tar_obj.close()
image = await docker.images.inspect(name=name)
assert image