本文整理汇总了Python中atomicapp.nulecule.base.NuleculeComponent.config方法的典型用法代码示例。如果您正苦于以下问题:Python NuleculeComponent.config方法的具体用法?Python NuleculeComponent.config怎么用?Python NuleculeComponent.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atomicapp.nulecule.base.NuleculeComponent
的用法示例。
在下文中一共展示了NuleculeComponent.config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_render_for_local_app_with_artifacts_for_provider
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import config [as 别名]
def test_render_for_local_app_with_artifacts_for_provider(
self, mock_render_artifact, mock_get_artifact_paths_for_provider,
mock_get_context):
"""Test rendering artifacts for a local Nulecule component"""
provider_key = 'some-provider'
dryrun = False
expected_rendered_artifacts = [
'some/path/.artifact1', 'some/path/.artifact2']
context = {'a': 'b'}
mock_get_artifact_paths_for_provider.return_value = [
'some/path/artifact1', 'some/path/artifact2']
mock_render_artifact.side_effect = lambda path, context, provider: path.replace('artifact', '.artifact')
mock_get_context.return_value = context
nc = NuleculeComponent(name='some-app', basepath='some/path')
nc.config = {'general': {'key1': 'val1'}, 'some-provider': {'a': 'b'}}
nc.artifacts = {
'some-provider': ['artifact1', 'artifact2'],
'x': ['foo']
}
nc.render(provider_key, dryrun)
mock_get_artifact_paths_for_provider.assert_called_once_with(
provider_key)
mock_render_artifact.assert_any_call('some/path/artifact1', context,
'some-provider')
mock_render_artifact.assert_any_call('some/path/artifact2', context,
'some-provider')
mock_get_artifact_paths_for_provider.assert_called_once_with(
provider_key)
self.assertEqual(nc.rendered_artifacts[provider_key],
expected_rendered_artifacts)
示例2: test_render_for_local_app_with_missing_artifacts_from_nulecule
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import config [as 别名]
def test_render_for_local_app_with_missing_artifacts_from_nulecule(self):
"""
Test rendering a Nulecule component with no artifacts provided in the
Nulecule file.
"""
nc = NuleculeComponent(name='some-app', basepath='some/path')
nc.config = {}
with self.assertRaises(NuleculeException):
nc.render()
示例3: test_render_for_local_app_with_missing_artifacts_for_provider
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import config [as 别名]
def test_render_for_local_app_with_missing_artifacts_for_provider(self):
"""
Test rendering a Nulecule component with missing artifacts for a
provider.
"""
provider_key = 'some-provider'
dryrun = False
nc = NuleculeComponent(name='some-app', basepath='some/path')
nc.config = {}
nc.artifacts = {'x': ['some-artifact']}
self.assertRaises(NuleculeException, nc.render, provider_key, dryrun)
示例4: test_load_config_external_app
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import config [as 别名]
def test_load_config_external_app(self):
"""Test load config for external app"""
params = [
{'name': 'key1', 'description': 'key1'},
{'name': 'key2', 'description': 'key2'}
]
initial_config = {
'general': {'a': 'b', 'key2': 'val2'},
'some-app': {'key1': 'val1'}
}
config = Config(answers=initial_config)
mock_nulecule = mock.Mock(
name='nulecule',
spec=Nulecule('some-id', '0.0.2', config, [], 'some/path')
)
nc = NuleculeComponent('some-app', 'some/path', params=params)
nc._app = mock_nulecule
nc.config = config
nc.load_config()
mock_nulecule.load_config.assert_called_once_with(
config=config, ask=False, skip_asking=False)