本文整理汇总了Python中atomicapp.nulecule.base.NuleculeComponent.render方法的典型用法代码示例。如果您正苦于以下问题:Python NuleculeComponent.render方法的具体用法?Python NuleculeComponent.render怎么用?Python NuleculeComponent.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atomicapp.nulecule.base.NuleculeComponent
的用法示例。
在下文中一共展示了NuleculeComponent.render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_render_for_local_app_with_artifacts_for_provider
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import render [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 render [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_external_app
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import render [as 别名]
def test_render_for_external_app(self):
"""Test rendering a nulecule component pointing to an external app"""
mock_nulecule = mock.Mock(name='nulecule')
provider_key = 'some-provider'
dryrun = False
nc = NuleculeComponent(name='some-app', basepath='some/path')
nc._app = mock_nulecule
nc.render(provider_key, dryrun)
mock_nulecule.render.assert_called_once_with(
provider_key=provider_key, dryrun=dryrun)