diff options
Diffstat (limited to 'tests/integration/models_containers_test.py')
-rw-r--r-- | tests/integration/models_containers_test.py | 19 |
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) |