Use json to encode invalid values in configuration errors so that the user sees a proper repr of the value.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
475a091768
commit
bf1552da79
8 changed files with 17 additions and 3 deletions
|
|
@ -552,7 +552,9 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_config_extra_hosts_list_of_dicts_validation_error(self):
|
||||
expected_error_msg = "key 'extra_hosts' contains {'somehost': '162.242.195.82'}, which is an invalid type, it should be a string"
|
||||
expected_error_msg = (
|
||||
"key 'extra_hosts' contains {\"somehost\": \"162.242.195.82\"}, "
|
||||
"which is an invalid type, it should be a string")
|
||||
|
||||
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
|
||||
config.load(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
from __future__ import absolute_import
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
from compose.config.errors import ConfigurationError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue