当前位置: 首页>>代码示例>>Python>>正文


Python Mock.check_mode方法代码示例

本文整理汇总了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
开发者ID:awiddersheim,项目名称:ansible,代码行数:16,代码来源:test_raw.py

示例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)
开发者ID:awiddersheim,项目名称:ansible,代码行数:18,代码来源:test_raw.py

示例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)
开发者ID:awiddersheim,项目名称:ansible,代码行数:18,代码来源:test_raw.py

示例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)
开发者ID:2ndQuadrant,项目名称:ansible,代码行数:19,代码来源:test_raw.py


注:本文中的ansible.compat.tests.mock.Mock.check_mode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。