mirror of https://github.com/docker/compose.git
Add a test for invalid field 'name', and fix an existing test for invalid service names.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
1f7faadc77
commit
19b2c41c7e
|
@ -77,8 +77,8 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_config_invalid_service_names(self):
|
||||
with self.assertRaises(ConfigurationError):
|
||||
for invalid_name in ['?not?allowed', ' ', '', '!', '/', '\xe2']:
|
||||
for invalid_name in ['?not?allowed', ' ', '', '!', '/', '\xe2']:
|
||||
with pytest.raises(ConfigurationError):
|
||||
config.load(
|
||||
build_config_details(
|
||||
{invalid_name: {'image': 'busybox'}},
|
||||
|
@ -87,6 +87,16 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
)
|
||||
|
||||
def test_load_with_invalid_field_name(self):
|
||||
config_details = build_config_details(
|
||||
{'web': {'image': 'busybox', 'name': 'bogus'}},
|
||||
'working_dir',
|
||||
'filename.yml')
|
||||
with pytest.raises(ConfigurationError) as exc:
|
||||
config.load(config_details)
|
||||
error_msg = "Unsupported config option for 'web' service: 'name'"
|
||||
assert error_msg in exc.exconly()
|
||||
|
||||
def test_config_integer_service_name_raise_validation_error(self):
|
||||
expected_error_msg = "Service name: 1 needs to be a string, eg '1'"
|
||||
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
|
||||
|
|
Loading…
Reference in New Issue