本文整理汇总了Python中pcs.lib.env.LibraryEnvironment.cmd_runner方法的典型用法代码示例。如果您正苦于以下问题:Python LibraryEnvironment.cmd_runner方法的具体用法?Python LibraryEnvironment.cmd_runner怎么用?Python LibraryEnvironment.cmd_runner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pcs.lib.env.LibraryEnvironment
的用法示例。
在下文中一共展示了LibraryEnvironment.cmd_runner方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_cmd_runner_no_options
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import cmd_runner [as 别名]
def test_cmd_runner_no_options(self, mock_runner):
expected_runner = mock.MagicMock()
mock_runner.return_value = expected_runner
env = LibraryEnvironment(self.mock_logger, self.mock_reporter)
runner = env.cmd_runner()
self.assertEqual(expected_runner, runner)
mock_runner.assert_called_once_with(
self.mock_logger,
self.mock_reporter,
{}
)
示例2: PushCib
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import cmd_runner [as 别名]
class PushCib(TestCase):
def setUp(self):
self.env = LibraryEnvironment(
mock.MagicMock(logging.Logger),
MockLibraryReportProcessor()
)
def test_run_only_push_when_without_wait(self, wait_for_idle, push_cib_xml):
self.env.push_cib(etree.fromstring("<cib/>"))
push_cib_xml.assert_called_once_with("<cib/>")
wait_for_idle.assert_not_called()
def test_run_wait_when_wait_specified(self, wait_for_idle, push_cib_xml):
self.env.push_cib(etree.fromstring("<cib/>"), 10)
push_cib_xml.assert_called_once_with("<cib/>")
wait_for_idle.assert_called_once_with(self.env.cmd_runner(), 10)
示例3: test_cmd_runner_all_options
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import cmd_runner [as 别名]
def test_cmd_runner_all_options(self, mock_runner):
expected_runner = mock.MagicMock()
mock_runner.return_value = expected_runner
user = "testuser"
env = LibraryEnvironment(
self.mock_logger,
self.mock_reporter,
user_login=user
)
runner = env.cmd_runner()
self.assertEqual(expected_runner, runner)
mock_runner.assert_called_once_with(
self.mock_logger,
self.mock_reporter,
{"CIB_user": user}
)
示例4: test_dump_cib_file
# 需要导入模块: from pcs.lib.env import LibraryEnvironment [as 别名]
# 或者: from pcs.lib.env.LibraryEnvironment import cmd_runner [as 别名]
def test_dump_cib_file(self, mock_tmpfile, mock_runner):
expected_runner = mock.MagicMock()
mock_runner.return_value = expected_runner
mock_instance = mock.MagicMock()
mock_instance.name = rc("file.tmp")
mock_tmpfile.return_value = mock_instance
env = LibraryEnvironment(
self.mock_logger,
self.mock_reporter,
cib_data="<cib />"
)
runner = env.cmd_runner()
self.assertEqual(expected_runner, runner)
mock_runner.assert_called_once_with(
self.mock_logger,
self.mock_reporter,
{
"LC_ALL": "C",
"CIB_file": rc("file.tmp"),
}
)
mock_tmpfile.assert_called_once_with("<cib />")