本文整理汇总了Python中ansible.compat.tests.mock.Mock.check_mode方法的典型用法代码示例。如果您正苦于以下问题:Python Mock.check_mode方法的具体用法?Python Mock.check_mode怎么用?Python Mock.check_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible.compat.tests.mock.Mock
的用法示例。
在下文中一共展示了Mock.check_mode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_raw_check_mode_is_True
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import check_mode [as 别名]
def test_raw_check_mode_is_True(self):
play_context = Mock()
task = MagicMock(Task)
task.async_val = False
connection = Mock()
task.args = {'_raw_params': 'Args1'}
play_context.check_mode = True
try:
self.mock_am = ActionModule(task, connection, play_context, loader=None, templar=None, shared_loader_obj=None)
except AnsibleActionFail:
pass
示例2: test_raw_test_environment_is_None
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import check_mode [as 别名]
def test_raw_test_environment_is_None(self):
play_context = Mock()
task = MagicMock(Task)
task.async_val = False
connection = Mock()
task.args = {'_raw_params': 'Args1'}
task.environment = None
play_context.check_mode = False
self.mock_am = ActionModule(task, connection, play_context, loader=None, templar=None, shared_loader_obj=None)
self.mock_am._low_level_execute_command = Mock(return_value={})
self.mock_am.display = Mock()
self.assertEqual(task.environment, None)
示例3: test_raw_executable_is_not_empty_string
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import check_mode [as 别名]
def test_raw_executable_is_not_empty_string(self):
play_context = Mock()
task = MagicMock(Task)
task.async_val = False
connection = Mock()
task.args = {'_raw_params': 'Args1'}
play_context.check_mode = False
self.mock_am = ActionModule(task, connection, play_context, loader=None, templar=None, shared_loader_obj=None)
self.mock_am._low_level_execute_command = Mock(return_value={})
self.mock_am.display = Mock()
self.mock_am.run()
self.mock_am._low_level_execute_command.assert_called_with('Args1', executable=False)
示例4: test_raw_check_mode_is_True
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import check_mode [as 别名]
def test_raw_check_mode_is_True(self):
play_context = Mock()
task = MagicMock(Task)
task.async = MagicMock()
connection = Mock()
task.args = {'_raw_params': 'Args1'}
play_context.check_mode = True
self.mock_am = ActionModule(task, connection, play_context, loader=None, templar=None, shared_loader_obj=None)
self.mock_am._low_level_execute_command = Mock(return_value = {})
self.mock_am.display = Mock()
skipped_result = self.mock_am.run()
self.assertEqual(skipped_result.get('skipped'), True)