本文整理汇总了Python中pcs.lib.env.LibraryEnvironment.get_cib_xml方法的典型用法代码示例。如果您正苦于以下问题:Python LibraryEnvironment.get_cib_xml方法的具体用法?Python LibraryEnvironment.get_cib_xml怎么用?Python LibraryEnvironment.get_cib_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pcs.lib.env.LibraryEnvironment
的用法示例。
在下文中一共展示了LibraryEnvironment.get_cib_xml方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_sucess_create
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import get_cib_xml [as 别名]
def test_sucess_create(self):
resource_xml = '<primitive id="resourceA" class="service" type="exim"/>'
cib = (
self.create_cib()
.append_to_first_tag_name('resources', resource_xml)
)
env = Env(self.mock_logger, self.mock_reporter, cib_data=str(cib))
ticket_command.create(env, "ticketA", "resourceA", {
"loss-policy": "fence",
"rsc-role": "master"
})
assert_xml_equal(
env.get_cib_xml(),
str(cib.append_to_first_tag_name(
'constraints', """
<rsc_ticket
id="ticket-ticketA-resourceA-Master"
rsc="resourceA"
rsc-role="Master"
ticket="ticketA"
loss-policy="fence"
/>
"""
))
)
示例2: test_cib_set
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import get_cib_xml [as 别名]
def test_cib_set(self, mock_get_cib, mock_push_cib):
cib_data = "test cib data"
new_cib_data = "new test cib data"
env = LibraryEnvironment(
self.mock_logger,
self.mock_reporter,
cib_data=cib_data
)
self.assertFalse(env.is_cib_live)
self.assertEqual(cib_data, env.get_cib_xml())
self.assertEqual(0, mock_get_cib.call_count)
env.push_cib_xml(new_cib_data)
self.assertEqual(0, mock_push_cib.call_count)
self.assertEqual(new_cib_data, env.get_cib_xml())
self.assertEqual(0, mock_get_cib.call_count)
示例3: test_cib_not_set
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import get_cib_xml [as 别名]
def test_cib_not_set(self, mock_get_cib, mock_push_cib):
cib_data = "test cib data"
new_cib_data = "new test cib data"
mock_get_cib.return_value = cib_data
env = LibraryEnvironment(self.mock_logger, self.mock_reporter)
self.assertTrue(env.is_cib_live)
self.assertEqual(cib_data, env.get_cib_xml())
self.assertEqual(1, mock_get_cib.call_count)
env.push_cib_xml(new_cib_data)
self.assertEqual(1, mock_push_cib.call_count)