summaryrefslogtreecommitdiff
path: root/tests/integration/api_exec_test.py
diff options
context:
space:
mode:
authorJoffrey F <joffrey@docker.com>2019-01-09 10:52:50 -0800
committerJoffrey F <joffrey@docker.com>2019-01-09 11:30:58 -0800
commit65bebc085ab8bb36e5d6de44399b8480e7ae3e68 (patch)
tree4d29cdb1da83347a0f58184b84ede21fa8327c8f /tests/integration/api_exec_test.py
parent6969e8becde593ee3dc1d3093d9299502ccc10ed (diff)
downloaddocker-py-2199-proxy-support.tar.gz
Style fixes and removed some unused code2199-proxy-support
Signed-off-by: Joffrey F <joffrey@docker.com>
Diffstat (limited to 'tests/integration/api_exec_test.py')
-rw-r--r--tests/integration/api_exec_test.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/tests/integration/api_exec_test.py b/tests/integration/api_exec_test.py
index 8947b41..e6079eb 100644
--- a/tests/integration/api_exec_test.py
+++ b/tests/integration/api_exec_test.py
@@ -9,37 +9,42 @@ from ..helpers import (
class ExecTest(BaseAPIIntegrationTest):
- def test_execute_proxy_env(self):
+ def test_execute_command_with_proxy_env(self):
# Set a custom proxy config on the client
self.client._proxy_configs = ProxyConfig(
- ftp='a', https='b', http='c', no_proxy='d')
+ ftp='a', https='b', http='c', no_proxy='d'
+ )
container = self.client.create_container(
- BUSYBOX, 'cat', detach=True, stdin_open=True)
- id = container['Id']
- self.client.start(id)
- self.tmp_containers.append(id)
+ BUSYBOX, 'cat', detach=True, stdin_open=True,
+ use_config_proxy=True,
+ )
+ self.client.start(container)
+ self.tmp_containers.append(container)
cmd = 'sh -c "env | grep -i proxy"'
# First, just make sure the environment variables from the custom
# config are set
- res = self.client.exec_create(id, cmd=cmd, use_config_proxy=True)
+
+ res = self.client.exec_create(container, cmd=cmd)
output = self.client.exec_start(res).decode('utf-8').split('\n')
expected = [
'ftp_proxy=a', 'https_proxy=b', 'http_proxy=c', 'no_proxy=d',
- 'FTP_PROXY=a', 'HTTPS_PROXY=b', 'HTTP_PROXY=c', 'NO_PROXY=d']
+ 'FTP_PROXY=a', 'HTTPS_PROXY=b', 'HTTP_PROXY=c', 'NO_PROXY=d'
+ ]
for item in expected:
assert item in output
# Overwrite some variables with a custom environment
env = {'https_proxy': 'xxx', 'HTTPS_PROXY': 'XXX'}
- res = self.client.exec_create(
- id, cmd=cmd, environment=env, use_config_proxy=True)
+
+ res = self.client.exec_create(container, cmd=cmd, environment=env)
output = self.client.exec_start(res).decode('utf-8').split('\n')
expected = [
'ftp_proxy=a', 'https_proxy=xxx', 'http_proxy=c', 'no_proxy=d',
- 'FTP_PROXY=a', 'HTTPS_PROXY=XXX', 'HTTP_PROXY=c', 'NO_PROXY=d']
+ 'FTP_PROXY=a', 'HTTPS_PROXY=XXX', 'HTTP_PROXY=c', 'NO_PROXY=d'
+ ]
for item in expected:
assert item in output