summaryrefslogtreecommitdiff
path: root/tests/unit/container_test.py
diff options
context:
space:
mode:
authorAanand Prasad <aanand.prasad@gmail.com>2016-01-14 16:33:26 +0000
committerAanand Prasad <aanand.prasad@gmail.com>2016-01-14 18:19:35 +0000
commitd00a5bb08671dc43c4db1fb8dc2ea90b68bbc1d9 (patch)
tree85c95101938ddfdb5fe38d8389d0ea98823bf808 /tests/unit/container_test.py
parente2878cbcc3a7eef99917adc1be252800b0e41ece (diff)
downloaddocker-py-d00a5bb08671dc43c4db1fb8dc2ea90b68bbc1d9.tar.gz
Implement support for network-scoped aliases
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
Diffstat (limited to 'tests/unit/container_test.py')
-rw-r--r--tests/unit/container_test.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/unit/container_test.py b/tests/unit/container_test.py
index e1dda3e..c2b2573 100644
--- a/tests/unit/container_test.py
+++ b/tests/unit/container_test.py
@@ -7,6 +7,7 @@ import pytest
import six
from . import fake_api
+from ..base import requires_api_version
from .api_test import (
DockerClientTest, url_prefix, fake_request, DEFAULT_TIMEOUT_SECONDS,
fake_inspect_container
@@ -983,6 +984,38 @@ class CreateContainerTest(DockerClientTest):
self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'})
+ @requires_api_version('1.22')
+ def test_create_container_with_aliases(self):
+ self.client.create_container(
+ 'busybox', 'ls',
+ host_config=self.client.create_host_config(
+ network_mode='some-network',
+ ),
+ networking_config=self.client.create_networking_config({
+ 'some-network': self.client.create_endpoint_config(
+ aliases=['foo', 'bar'],
+ ),
+ }),
+ )
+
+ args = fake_request.call_args
+ self.assertEqual(json.loads(args[1]['data']),
+ json.loads('''
+ {"Tty": false, "Image": "busybox",
+ "Cmd": ["ls"], "AttachStdin": false,
+ "AttachStderr": true,
+ "AttachStdout": true, "OpenStdin": false,
+ "StdinOnce": false,
+ "NetworkDisabled": false,
+ "HostConfig": {
+ "NetworkMode": "some-network"
+ },
+ "NetworkingConfig": {
+ "EndpointsConfig": {
+ "some-network": {"Aliases": ["foo", "bar"]}
+ }
+ }}'''))
+
class ContainerTest(DockerClientTest):
def test_list_containers(self):