summaryrefslogtreecommitdiff
path: root/tests/integration/models_containers_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2017-05-11 17:44:23 -0700
committerJoffrey F <joffrey@docker.com>2017-05-12 14:28:27 -0700
commit95297dc2e760b992d7d31d485a66d02728944f36 (patch)
tree5ef3893b1c2850a6dd5d9f0db3f9bd6cde55f586 /tests/integration/models_containers_test.py
parent007ab677a1ff7748596ca7703ad05d89a4c881cd (diff)
downloaddocker-py-1433-run-networks.tar.gz
Replace erroneous networks argument in containers.run with singular1433-run-networks
network equivalent. Small docfixes Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/integration/models_containers_test.py')
-rw-r--r--tests/integration/models_containers_test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/integration/models_containers_test.py b/tests/integration/models_containers_test.py
index 4f1e6a1..b76a88f 100644
--- a/tests/integration/models_containers_test.py
+++ b/tests/integration/models_containers_test.py
@@ -1,6 +1,7 @@
import docker
import tempfile
from .base import BaseIntegrationTest, TEST_API_VERSION
+from ..helpers import random_name
class ContainerCollectionTest(BaseIntegrationTest):
@@ -69,6 +70,24 @@ class ContainerCollectionTest(BaseIntegrationTest):
)
self.assertEqual(out, b'hello\n')
+ def test_run_with_network(self):
+ net_name = random_name()
+ client = docker.from_env(version=TEST_API_VERSION)
+ client.networks.create(net_name)
+ self.tmp_networks.append(net_name)
+
+ container = client.containers.run(
+ 'alpine', 'echo hello world', network=net_name,
+ detach=True
+ )
+ self.tmp_containers.append(container.id)
+
+ attrs = container.attrs
+
+ assert 'NetworkSettings' in attrs
+ assert 'Networks' in attrs['NetworkSettings']
+ assert list(attrs['NetworkSettings']['Networks'].keys()) == [net_name]
+
def test_get(self):
client = docker.from_env(version=TEST_API_VERSION)
container = client.containers.run("alpine", "sleep 300", detach=True)