Kaydet (Commit) 5bedd32a authored tarafından fermayo's avatar fermayo

Fix creating containers with env vars with unicode characters

Signed-off-by: 's avatarFernando Mayo <fernando@docker.com>
üst fb419652
......@@ -993,7 +993,7 @@ def format_environment(environment):
def format_env(key, value):
if value is None:
return key
return '{key}={value}'.format(key=key, value=value)
return u'{key}={value}'.format(key=key, value=value)
return [format_env(*var) for var in six.iteritems(environment)]
......
# -*- coding: utf-8 -*-
import datetime
import json
import signal
......@@ -1155,6 +1157,24 @@ class CreateContainerTest(DockerClientTest):
args[1]['timeout'], DEFAULT_TIMEOUT_SECONDS
)
def test_create_container_with_unicode_envvars(self):
envvars_dict = {
'foo': u'☃',
}
expected = [
u'foo=☃'
]
self.client.create_container(
'busybox', 'true',
environment=envvars_dict,
)
args = fake_request.call_args
self.assertEqual(args[0][1], url_prefix + 'containers/create')
self.assertEqual(json.loads(args[1]['data'])['Env'], expected)
class ContainerTest(DockerClientTest):
def test_list_containers(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment