Improve error messages from oneOf schema errors
oneOf schema ValidationError takes a little more work to parse and pull out more detail so we can give a better error message back to the user. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
418ec5336b
commit
cf7b595385
2 changed files with 39 additions and 17 deletions
|
|
@ -183,7 +183,8 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_invalid_list_of_strings_format(self):
|
||||
expected_error_msg = "'command' contains an invalid type, valid types are string or array"
|
||||
expected_error_msg = "Service 'web' configuration key 'command' contains 1"
|
||||
expected_error_msg += ", which is an invalid type, it should be a string"
|
||||
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
|
||||
config.load(
|
||||
config.ConfigDetails(
|
||||
|
|
@ -222,7 +223,7 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_config_extra_hosts_list_of_dicts_validation_error(self):
|
||||
expected_error_msg = "Service 'web' configuration key 'extra_hosts' contains an invalid type"
|
||||
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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue