How to use the aiodocker.utils function in aiodocker

To help you get started, we’ve selected a few aiodocker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / aiodocker / tests / test_utils.py View on Github external
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
github aio-libs / aiodocker / tests / test_images.py View on Github external
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
github aio-libs / aiodocker / tests / test_images.py View on Github external
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