Handle $ref defined types errors
We use $ref in the schema to allow us to specify multiple type, eg command, it can be a string or a list of strings. It required some extra parsing to retrieve a helpful type to display in our error message rather than 'string or string'. Which while correct, is not helpful. We value helpful. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
68de84a0bf
commit
f8efb54c80
2 changed files with 27 additions and 2 deletions
|
|
@ -160,6 +160,19 @@ 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 list of strings"
|
||||
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
|
||||
config.load(
|
||||
config.ConfigDetails(
|
||||
{
|
||||
'web': {'build': '.', 'command': [1]}
|
||||
},
|
||||
'tests/fixtures/extends',
|
||||
'filename.yml'
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class InterpolationTest(unittest.TestCase):
|
||||
@mock.patch.dict(os.environ)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue