def test_load(self): service_dicts = config.load( config.ConfigDetails( { 'foo': {'image': 'busybox'}, 'bar': {'environment': ['FOO=1']}, }, 'working_dir', 'filename.yml' ) ) self.assertEqual( sorted(service_dicts, key=lambda d: d['name']), sorted([ { 'name': 'bar', 'environment': {'FOO': '1'}, }, { 'name': 'foo', 'image': 'busybox', } ]) )
def test_nonexistent_path(self): with self.assertRaises(config.ConfigurationError): config.load( config.ConfigDetails({ 'foo': { 'build': 'nonexistent.path' }, }, 'working_dir', 'filename.yml'))
def test_load_throws_error_when_not_dict(self): with self.assertRaises(config.ConfigurationError): config.load( config.ConfigDetails( {'web': 'busybox:latest'}, 'working_dir', 'filename.yml' ) )
def make_project(self, cfg): return Project.from_dicts(name='composetest', client=self.client, service_dicts=config.load( config.ConfigDetails( cfg, 'working_dir', None)))
def build_service_dicts(service_config): return config.load(config.ConfigDetails(service_config, 'working_dir', None))