Ejemplo n.º 1
0
 def test_module_fail_when_required_args_missing(self):
     ''' required arguments are reported as errors '''
     with pytest.raises(AnsibleFailJson) as exc:
         set_module_args(self.set_default_args_fail_check())
         fileSystem_module()
     print('Info: test_module_fail_when_required_args_missing: %s' %
           exc.value.args[0]['msg'])
 def test_module_fail_when_required_args_present(self):
     ''' required arguments are reported as errors '''
     with pytest.raises(AnsibleExitJson) as exc:
         set_module_args(self.set_default_args_pass_check())
         fileSystem_module()
         exit_json(changed=True, msg="Induced arguments check")
     print('Info: test_module_fail_when_required_args_present: %s' % exc.value.args[0]['msg'])
     assert exc.value.args[0]['changed']
 def test_create_aws_netapp_cvs_snapshots_pass(self, get_post_api, get_state_api, get_filesystem_id):
     set_module_args(self.set_args_create_aws_netapp_cvs_filesystems())
     my_obj = fileSystem_module()
     get_filesystem_id.return_value = None
     get_state_api.return_value = 'done'
     response = {'jobs': [{'jobId': 'dummy'}]}
     get_post_api.return_value = response, None
     with pytest.raises(AnsibleExitJson) as exc:
         my_obj.apply()
     print('Info: test_create_aws_netapp_cvs_filesystem_pass: %s' % repr(exc.value.args[0]))
     assert exc.value.args[0]['changed']