本文整理匯總了Python中ansibledebugger.interpreter.simple_interpreter.Interpreter.do_l方法的典型用法代碼示例。如果您正苦於以下問題:Python Interpreter.do_l方法的具體用法?Python Interpreter.do_l怎麽用?Python Interpreter.do_l使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ansibledebugger.interpreter.simple_interpreter.Interpreter
的用法示例。
在下文中一共展示了Interpreter.do_l方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_list
# 需要導入模塊: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 別名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_l [as 別名]
def test_list(self, mock_stdout):
task_name = 'test task'
task_mock = Mock(name=task_name)
module_name = 'test module'
module_args = 'ma_k=ma_v'
complex_args = {'ca_k': 'ca_v'}
complex_args_expect = 'ca_k: ca_v'
keyword = {'ignore_errors': False}
keyword_expect = 'ignore_errors: \'False\''
hostname = 'test_host'
actual_host_expect = 'actual_host'
conn_mock = Mock(host=actual_host_expect)
action_plugin_wrapper_info = Mock(conn=conn_mock)
optional_info = {'action_plugin_wrapper': action_plugin_wrapper_info}
groups = ['a', 'b']
groups_expect = 'a,b'
vars = {'inventory_hostname': hostname, 'group_names': groups}
vars.update(keyword)
interpreter = Interpreter(TaskInfo(module_name, module_args, vars, complex_args, task=task_mock),
ErrorInfo(), None, optional_info)
interpreter.do_l(None)
self.assertIn(task_name, mock_stdout.getvalue())
self.assertIn(module_name, mock_stdout.getvalue())
self.assertIn(module_args, mock_stdout.getvalue())
self.assertIn(complex_args_expect, mock_stdout.getvalue())
self.assertIn(keyword_expect, mock_stdout.getvalue())
self.assertIn(hostname, mock_stdout.getvalue())
self.assertIn(actual_host_expect, mock_stdout.getvalue())
self.assertIn(groups_expect, mock_stdout.getvalue())