def call_command(self, module_args, vsim=False):
     ''' utility function to call apply '''
     module_args.update(self.set_default_args(vsim=vsim))
     set_module_args(module_args)
     my_obj = my_module()
     my_obj.asup_log_for_cserver = Mock(return_value=None)
     if not vsim:
         # mock the connection
         my_obj.server = self.server
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     msg = exc.value.args[0]['msg']
     return msg
 def test_module_fail_when_required_args_missing(self):
     ''' required arguments are reported as errors '''
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args({})
         my_module()
     print('Info: %s' % exc.value.args[0]['msg'])