Integration test for run command with networking enabled

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2015-10-30 14:15:47 +01:00
parent 596261e759
commit 072e7687ae
1 changed files with 14 additions and 0 deletions

View File

@ -508,6 +508,20 @@ class CLITestCase(DockerClientTestCase):
container, = service.containers(stopped=True, one_off=True)
self.assertEqual(container.name, name)
@mock.patch('dockerpty.start')
def test_run_with_networking(self, _):
self.require_api_version('1.21')
client = docker_client(version='1.21')
self.command.base_dir = 'tests/fixtures/simple-dockerfile'
self.command.dispatch(['--x-networking', 'run', 'simple', 'true'], None)
service = self.project.get_service('simple')
container, = service.containers(stopped=True, one_off=True)
networks = client.networks(names=[self.project.name])
for n in networks:
self.addCleanup(client.remove_network, n['id'])
self.assertEqual(len(networks), 1)
self.assertEqual(container.human_readable_command, u'true')
def test_rm(self):
service = self.project.get_service('simple')
service.create_container()