Add test for environment variable dashes support

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2015-11-11 12:52:30 -08:00 committed by Daniel Nephin
parent 63c3e6f58c
commit d52c969f94
1 changed files with 11 additions and 13 deletions

View File

@ -480,20 +480,18 @@ class ConfigTest(unittest.TestCase):
self.assertTrue(mock_logging.warn.called) self.assertTrue(mock_logging.warn.called)
self.assertTrue(expected_warning_msg in mock_logging.warn.call_args[0][0]) self.assertTrue(expected_warning_msg in mock_logging.warn.call_args[0][0])
def test_config_invalid_environment_dict_key_raises_validation_error(self): def test_config_valid_environment_dict_key_contains_dashes(self):
expected_error_msg = "Service 'web' configuration key 'environment' contains unsupported option: '---'" services = config.load(
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
config.load(
build_config_details( build_config_details(
{'web': { {'web': {
'image': 'busybox', 'image': 'busybox',
'environment': {'---': 'nope'} 'environment': {'SPRING_JPA_HIBERNATE_DDL-AUTO': 'none'}
}}, }},
'working_dir', 'working_dir',
'filename.yml' 'filename.yml'
) )
) )
self.assertEqual(services[0]['environment']['SPRING_JPA_HIBERNATE_DDL-AUTO'], 'none')
def test_load_yaml_with_yaml_error(self): def test_load_yaml_with_yaml_error(self):
tmpdir = py.test.ensuretemp('invalid_yaml_test') tmpdir = py.test.ensuretemp('invalid_yaml_test')