Skip to content

Commit

Permalink
Merge 5552e13 into eb81cf2
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-maier committed May 10, 2019
2 parents eb81cf2 + 5552e13 commit 0c6b67f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
21 changes: 20 additions & 1 deletion tests/end2end/test_zhmc_partition.py
Expand Up @@ -25,7 +25,7 @@
from zhmcclient.testutils.hmc_definition_fixtures import hmc_definition, hmc_session # noqa: F401, E501

from zhmc_ansible_modules import zhmc_partition
from .utils import mock_ansible_module, get_failure_msg, get_module_output
from .utils import mock_ansible_module, get_failure_msg

requests.packages.urllib3.disable_warnings()

Expand All @@ -40,6 +40,25 @@
)


def get_module_output(mod_obj):
"""
Return the module output as a tuple (changed, partition_properties) (i.e.
the arguments of the call to exit_json()).
If the module failed, return None.
"""

def func(changed, partition):
return changed, partition

if not mod_obj.exit_json.called:
return None
call_args = mod_obj.exit_json.call_args

# The following makes sure we get the arguments regardless of whether they
# were specified as positional or keyword arguments:
return func(*call_args[0], **call_args[1])


def assert_partition_props(partition_props):
"""
Assert the output object of the zhmc_partition module
Expand Down
19 changes: 0 additions & 19 deletions tests/end2end/utils.py
Expand Up @@ -47,22 +47,3 @@ def func(msg):
# The following makes sure we get the arguments regardless of whether they
# were specified as positional or keyword arguments:
return func(*call_args[0], **call_args[1])


def get_module_output(mod_obj):
"""
Return the module output as a tuple (changed, partition_properties) (i.e.
the arguments of the call to exit_json()).
If the module failed, return None.
"""

def func(changed, partition):
return changed, partition

if not mod_obj.exit_json.called:
return None
call_args = mod_obj.exit_json.call_args

# The following makes sure we get the arguments regardless of whether they
# were specified as positional or keyword arguments:
return func(*call_args[0], **call_args[1])

0 comments on commit 0c6b67f

Please sign in to comment.