Skip to content

Commit

Permalink
added_UT's
Browse files Browse the repository at this point in the history
  • Loading branch information
SHANDCRUZ committed Apr 29, 2021
1 parent 357983b commit 7a149ee
Show file tree
Hide file tree
Showing 5 changed files with 296 additions and 32 deletions.
3 changes: 2 additions & 1 deletion examples/oneview_user_facts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
role: "{{ role }}"
delegate_to: localhost

- debug: var=users
- debug: var=role

- name: Gather facts about lists of user's roles
oneview_user_facts:
Expand All @@ -62,3 +62,4 @@
delegate_to: localhost

- debug: var=users
- debug: var=user_roles
4 changes: 2 additions & 2 deletions library/oneview_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class UserModule(OneViewModule):
MSG_USERNAME_MISSING = 'userName field is missing.'
MSG_USERNAME_DOES_NOT_EXIT = 'userName doesn\'t exist.'
MSG_ROLELIST_MISSING = 'role_list field is missing.'
MSG_PASSWORD_MISSING = 'either oldPassword or newPassword field is missing.'
MSG_PASSWORD_MISSING = 'either oldPassword or newPassword field is missing.'
MSG_ROLENAME_MISSING = 'roleName field is missing.'
MSG_USERLIST_MISSING = 'users_list field is missing.'
MSG_FULLNAME_MISSING = 'fullName field is missing.'
Expand All @@ -253,7 +253,7 @@ def __init__(self):
'set_password']))

super().__init__(additional_arg_spec=additional_arg_spec,
validate_etag_support=True)
validate_etag_support=True)

self.resource_client = self.oneview_client.users

Expand Down
6 changes: 2 additions & 4 deletions library/oneview_user_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def __init__(self):
options=dict(required=False, type='list')
)

super(UserFactsModule, self).__init__(additional_arg_spec=argument_spec)
super().__init__(additional_arg_spec=argument_spec)
self.set_resource_object(self.oneview_client.users)

def execute_module(self):
Expand All @@ -124,8 +124,7 @@ def execute_module(self):
if self.options.get('getUserRoles'):
ansible_facts['user_roles'] = self.resource_client.get_role_associated_with_userName(self.module.params['userName'])


return dict(changed=False, ansible_facts=dict(users=ansible_facts))
return dict(changed=False, ansible_facts=ansible_facts)


def main():
Expand All @@ -134,4 +133,3 @@ def main():

if __name__ == '__main__':
main()

Loading

0 comments on commit 7a149ee

Please sign in to comment.