def test_module_args(self, mock_module, mock_client):
        """
        hpe3par volumeset - test module arguments
        """

        mock_module.params = self.PARAMS_FOR_PRESENT
        mock_module.return_value = mock_module
        volumeset.main()
        mock_module.assert_called_with(
            argument_spec=self.fields)
 def test_main_exit_functionality_success_with_issue_attr_dict(self, mock_volumeset, mock_module, mock_client):
     """
     hpe3par volumeset - success check
     """
     # This creates a instance of the AnsibleModule mock.
     mock_module.params = self.PARAMS_FOR_PRESENT
     mock_module.return_value = mock_module
     instance = mock_module.return_value
     mock_volumeset.return_value = (
         True, True, "Created volumeset host successfully.", {"dummy": "dummy"})
     volumeset.main()
     # AnsibleModule.exit_json should be called
     instance.exit_json.assert_called_with(
         changed=True, msg="Created volumeset host successfully.", issue={"dummy": "dummy"})
     # AnsibleModule.fail_json should not be called
     self.assertEqual(instance.fail_json.call_count, 0)
    def test_main_exit_functionality_fail(self, mock_volumeset, mock_module, mock_client):
        """
        hpe3par volumeset - exit fail check
        """
        # This creates a instance of the AnsibleModule mock.
        mock_module.params = self.PARAMS_FOR_PRESENT
        mock_module.return_value = mock_module
        instance = mock_module.return_value
        mock_volumeset.return_value = (
            False, False, "volumeset creation failed.", {"dummy": "dummy"})
        volumeset.main()

        # AnsibleModule.exit_json should not be activated
        self.assertEqual(instance.exit_json.call_count, 0)
        # AnsibleModule.fail_json should be called
        instance.fail_json.assert_called_with(msg='volumeset creation failed.')