зеркало из https://github.com/docker/docker-py.git
Properly convert non-string filters to expected string format
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Родитель
89ee08f511
Коммит
f83fe7c959
|
@ -386,7 +386,10 @@ def convert_filters(filters):
|
|||
v = 'true' if v else 'false'
|
||||
if not isinstance(v, list):
|
||||
v = [v, ]
|
||||
result[k] = v
|
||||
result[k] = [
|
||||
str(item) if not isinstance(item, six.string_types) else item
|
||||
for item in v
|
||||
]
|
||||
return json.dumps(result)
|
||||
|
||||
|
||||
|
|
|
@ -457,8 +457,8 @@ class UtilsTest(unittest.TestCase):
|
|||
tests = [
|
||||
({'dangling': True}, '{"dangling": ["true"]}'),
|
||||
({'dangling': "true"}, '{"dangling": ["true"]}'),
|
||||
({'exited': 0}, '{"exited": [0]}'),
|
||||
({'exited': [0, 1]}, '{"exited": [0, 1]}'),
|
||||
({'exited': 0}, '{"exited": ["0"]}'),
|
||||
({'exited': [0, 1]}, '{"exited": ["0", "1"]}'),
|
||||
]
|
||||
|
||||
for filters, expected in tests:
|
||||
|
|
Загрузка…
Ссылка в новой задаче