def test_build_loader_without_flatten(self): source = {'base': {'one': 'thing', 'two': 'foo'}} loader_func = mock.Mock(return_value=source) config_loader = loader.build_loader(loader_func) config = config_loader(source, flatten=False) assert_equal(config, source)
def test_build_loader_optional(self): err_msg = "Failed to do" loader_func = mock.Mock() loader_func.side_effect = ValueError(err_msg) config_loader = loader.build_loader(loader_func) config_loader(optional=True) assert_raises(ValueError, config_loader)
def test_build_loader(self): loader_func = mock.Mock() assert callable(loader.build_loader(loader_func))