def setUp(self):
def install(*args, **kw):
p = patch.object(*args, **kw)
p.start()
self.addCleanup(p.stop)
install(hookenv, 'relation_types', return_value=['rel', 'pear'])
install(hookenv, 'peer_relation_id', return_value='pear:9')
install(hookenv, 'relation_ids',
side_effect=lambda x: ['{}:{}'.format(x, i)
for i in range(9, 11)])
install(hookenv, 'related_units',
side_effect=lambda x: ['svc_' + x.replace(':', '/')])
install(hookenv, 'local_unit', return_value='foo/1')
install(hookenv, 'relation_get')
install(hookenv, 'relation_set')
# install(hookenv, 'is_leader', return_value=False)
评论列表
文章目录