Skip to content

Commit

Permalink
add test in test_images.py, update setup.py and tests/docker/README.md (
Browse files Browse the repository at this point in the history
#69)

* add test in test_images.py, update setup.py and tests/docker/README.md

* fix setup.py
  • Loading branch information
Christian Barra committed Jul 19, 2017
1 parent 0be85e6 commit 7053b84
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@
packages=[
'aiodocker',
],
python_requires='>=3.6',
python_requires='>=3.5',
install_requires=[
'aiohttp~=2.2.0',
'setuptools==36.2.0',
'aiohttp==2.2.3',
'yarl>=0.10',
],
extras_require={
Expand Down
11 changes: 3 additions & 8 deletions tests/docker/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
Used to test build images functions.

# Dockerfile
To build a docker image from a remote file.
Used for test `test_build_from_remote_file` inside `tests/test_images.py`

# tar
To build a docker image using a remote tar (docker_context.tar) as a local context.

To create the tar
```shell
tar -cvf docker_context.tar *
```
# docker_context.tar
Used for test `test_build_from_remote_tar` inside `tests/test_images.py`
22 changes: 19 additions & 3 deletions tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

@pytest.mark.asyncio
async def test_build_from_remote_file(docker):
remote = ("https://gist.githubusercontent.com/barrachri/"
"16a735971379352635a92d65036145f1/raw"
"/2b814ad3bf24af94a5623df03678816e37f2b6b7/Dockerfile")
remote = ("https://raw.githubusercontent.com/aio-libs/"
"aiodocker/master/tests/docker/Dockerfile")

tag = "image:1.0"
params = {'tag': tag, 'remote': remote, 'stream': True}
Expand All @@ -22,6 +21,23 @@ async def test_build_from_remote_file(docker):
assert image


@pytest.mark.asyncio
async def test_build_from_remote_tar(docker):
remote = ("https://github.com/aio-libs/aiodocker/"
"raw/master/tests/docker/docker_context.tar")

tag = "image_from_tar:1.0"
params = {'tag': tag, 'remote': remote, 'stream': True}
stream = await docker.images.build(**params)

async for output in stream:
if "Successfully tagged image_from_tar:1.0\n" in output:
break

image = await docker.images.get(tag)
assert image


@pytest.mark.asyncio
async def test_history(docker):
name = "image:1.0"
Expand Down

0 comments on commit 7053b84

Please sign in to comment.