''' unit test template for ONTAP Ansible module ''' from __future__ import print_function import json import pytest from ansible_collections.misc.not_a_real_collection.tests.unit.compat import unittest from ansible_collections.misc.not_a_real_collection.tests.unit.compat.mock import patch, Mock from ansible.module_utils import basic from ansible.module_utils._text import to_bytes import ansible_collections.misc.not_a_real_collection.plugins.module_utils.netapp as netapp_utils from ansible_collections.misc.not_a_real_collection.plugins.modules.na_ontap_user_role \ import NetAppOntapUserRole as role_module # module under test if not netapp_utils.has_netapp_lib(): pytestmark = pytest.mark.skip('skipping as missing required netapp_lib') def set_module_args(args): """prepare arguments so that they will be picked up during module creation""" args = json.dumps({'ANSIBLE_MODULE_ARGS': args}) basic._ANSIBLE_ARGS = to_bytes(args) # pylint: disable=protected-access class AnsibleExitJson(Exception): """Exception class to be raised by module.exit_json and caught by the test case""" pass class AnsibleFailJson(Exception):
hostname: "{{ netapp_hostname }}" username: "******" password: "******" """ RETURN = """ """ import traceback from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_native from ansible_collections.misc.not_a_real_collection.plugins.module_utils.netapp_module import NetAppModule import ansible_collections.misc.not_a_real_collection.plugins.module_utils.netapp as netapp_utils HAS_NETAPP_LIB = netapp_utils.has_netapp_lib() class NetAppOntapLUNCopy(object): def __init__(self): self.argument_spec = netapp_utils.na_ontap_host_argument_spec() self.argument_spec.update( dict( state=dict(required=False, choices=['present'], default='present'), destination_vserver=dict(required=True, type='str'), destination_path=dict(required=True, type='str'), source_path=dict(required=True, type='str'), source_vserver=dict(required=False, type='str'), ))