mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
@@ -63,6 +63,7 @@
|
||||
- name: verify apt module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'invocation' in apt_result"
|
||||
- "'changed' in apt_result"
|
||||
- "'stderr' in apt_result"
|
||||
- "'stdout' in apt_result"
|
||||
|
||||
@@ -155,17 +155,15 @@
|
||||
that:
|
||||
- complex_param == "this is a param in a complex arg with double quotes"
|
||||
|
||||
#- name: test variable module name
|
||||
# action: "{{ variable_module_name }} msg='this should be debugged'"
|
||||
# register: result
|
||||
#
|
||||
#- debug: var=result
|
||||
- name: test variable module name
|
||||
action: "{{ variable_module_name }} msg='this should be debugged'"
|
||||
register: result
|
||||
|
||||
#- name: assert the task with variable module name ran
|
||||
# assert:
|
||||
# that:
|
||||
# - result.invocation.module_name == "debug"
|
||||
# - result.msg == "this should be debugged"
|
||||
- name: assert the task with variable module name ran
|
||||
assert:
|
||||
that:
|
||||
- result.invocation.module_name == "debug"
|
||||
- result.msg == "this should be debugged"
|
||||
|
||||
- name: test conditional includes
|
||||
include: test_include_conditional.yml
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
- name: verify yum module outputs
|
||||
assert:
|
||||
that:
|
||||
- "'invocation' in yum_result"
|
||||
- "'changed' in yum_result"
|
||||
- "'msg' in yum_result"
|
||||
- "'rc' in yum_result"
|
||||
|
||||
@@ -29,9 +29,15 @@ from ansible.plugins.action import ActionBase
|
||||
|
||||
class TestActionBase(unittest.TestCase):
|
||||
|
||||
class DerivedActionBase(ActionBase):
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
# We're not testing the plugin run() method, just the helper
|
||||
# methods ActionBase defines
|
||||
return dict()
|
||||
|
||||
def test_sudo_only_if_user_differs(self):
|
||||
play_context = PlayContext()
|
||||
action_base = ActionBase(None, None, play_context, None, None, None)
|
||||
action_base = self.DerivedActionBase(None, None, play_context, None, None, None)
|
||||
action_base._connection = Mock(exec_command=Mock(return_value=(0, '', '')))
|
||||
|
||||
play_context.become = True
|
||||
|
||||
Reference in New Issue
Block a user