本文整理汇总了Python中atomicapp.nulecule.base.NuleculeComponent.load_config方法的典型用法代码示例。如果您正苦于以下问题:Python NuleculeComponent.load_config方法的具体用法?Python NuleculeComponent.load_config怎么用?Python NuleculeComponent.load_config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类atomicapp.nulecule.base.NuleculeComponent
的用法示例。
在下文中一共展示了NuleculeComponent.load_config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_config_external_app
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import load_config [as 别名]
def test_load_config_external_app(self, mock_merge_config):
"""Test load config for external app"""
mock_nulecule = mock.Mock(
name='nulecule',
spec=Nulecule('some-id', '0.0.2', {}, [], 'some/path')
)
params = [
{'name': 'key1'},
{'name': 'key2'}
]
initial_config = {
'general': {'a': 'b', 'key2': 'val2'},
'some-app': {'key1': 'val1'}
}
nc = NuleculeComponent('some-app', 'some/path', params=params)
nc._app = mock_nulecule
nc.load_config(config=copy.deepcopy(initial_config))
mock_nulecule.load_config.assert_called_once_with(
config={
'general': {'a': 'b', 'key2': 'val2'},
'some-app': {'key1': 'val1', 'key2': 'val2'}
}, ask=False, skip_asking=False)
mock_merge_config.assert_called_once_with(
nc.config, mock_nulecule.config)
示例2: test_load_config_local_app
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import load_config [as 别名]
def test_load_config_local_app(self):
"""Test load config for local app"""
params = [
{'name': 'key1', 'description': 'key1'},
{'name': 'key2', 'description': 'key2'}
]
initial_config = {
'general': {'a': 'b', 'key2': 'val2'},
'some-app': {'key1': 'val1'}
}
conf = Config(answers=initial_config)
nc = NuleculeComponent('some-app', 'some/path',
params=params, config=conf)
nc.load_config()
runtime_answers = nc.config.runtime_answers()
self.assertEqual(runtime_answers, {
'general': {
'a': 'b',
'key2': 'val2',
'provider': 'kubernetes',
'namespace': 'default'
},
'some-app': {'key1': 'val1'}
})
示例3: test_load_config_local_app
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import load_config [as 别名]
def test_load_config_local_app(self):
"""Test load config for local app"""
params = [
{'name': 'key1'},
{'name': 'key2'}
]
initial_config = {
'general': {'a': 'b', 'key2': 'val2'},
'some-app': {'key1': 'val1'}
}
nc = NuleculeComponent('some-app', 'some/path', params=params)
nc.load_config(config=copy.deepcopy(initial_config))
self.assertEqual(nc.config, {
'general': {'a': 'b', 'key2': 'val2'},
'some-app': {'key1': 'val1', 'key2': 'val2'}
})
示例4: test_load_config_external_app
# 需要导入模块: from atomicapp.nulecule.base import NuleculeComponent [as 别名]
# 或者: from atomicapp.nulecule.base.NuleculeComponent import load_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)