1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/tests/integration/targets/gitlab_group_members/tasks/main.yml

75 lines
2.7 KiB
YAML
Raw Permalink Normal View History

####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Test code for gitlab_group_members module
#
# Copyright (c) 2020, Zainab Alsaffar <Zainab.Alsaffar@mail.rit.edu>
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
- name: Install required library
pip:
name: python-gitlab
state: present
- name: Add a User to A GitLab Group
Enhancement to gitlab_group_members to accept user lists as input (#3047) * - fix to issue 3041 - add func to work with user lists - add func to set members to the ones give * Added version_added to new parameter * fixed elements in definition of gitlab_users nad wrong import in gitlab_users * linter issues fixed * added list elelements to argument_spec * More whitspeaces for the linter * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * adapted changelog * removed bugfix (other PR), changes due to review * changed input handling according to review * Fixed test findings * Added list of dict to allow for specifying user/access_level tuples * corrected doc section * fixed parameter definitions * removed strange additional import * Update changelogs/fragments/3041-gitlab_x_members_fix_and_enhancement.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_project_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed required if * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Added suggestions from PR * fixed identation problem * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Zainab Alsaffar <za5775@rit.edu> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Zainab Alsaffar <za5775@rit.edu> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Recommended changes from discussionst * Fixed issues from automatic tests * added missing metaclass due to test finding * added integration tests * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed optimization for only one user * Reverted gitlab_project_members to original version - changes will be done in a separate branch * added examples for new functionality * - fixed changelog after reverting gitlab_project_memebers - fully reverted gitlab_project_members * Fixed error handling: when single users are not updateable in bulk mode the exception should not stop the code flow but document the problem in the result. * Better error handling * on error give username, not gitlab numeric userid * Fixed broken check_mode * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Change from review Co-authored-by: Max Bidlingmaier <Max-Florian.Bidlingmaier@sap.com> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Zainab Alsaffar <za5775@rit.edu>
2021-08-31 15:07:52 +02:00
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_user: '{{ username }}'
access_level: '{{ gitlab_access_level }}'
state: present
- name: Remove a User from A GitLab Group
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_user: '{{ username }}'
Enhancement to gitlab_group_members to accept user lists as input (#3047) * - fix to issue 3041 - add func to work with user lists - add func to set members to the ones give * Added version_added to new parameter * fixed elements in definition of gitlab_users nad wrong import in gitlab_users * linter issues fixed * added list elelements to argument_spec * More whitspeaces for the linter * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * adapted changelog * removed bugfix (other PR), changes due to review * changed input handling according to review * Fixed test findings * Added list of dict to allow for specifying user/access_level tuples * corrected doc section * fixed parameter definitions * removed strange additional import * Update changelogs/fragments/3041-gitlab_x_members_fix_and_enhancement.yml Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_project_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed required if * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Added suggestions from PR * fixed identation problem * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Zainab Alsaffar <za5775@rit.edu> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Zainab Alsaffar <za5775@rit.edu> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Recommended changes from discussionst * Fixed issues from automatic tests * added missing metaclass due to test finding * added integration tests * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed optimization for only one user * Reverted gitlab_project_members to original version - changes will be done in a separate branch * added examples for new functionality * - fixed changelog after reverting gitlab_project_memebers - fully reverted gitlab_project_members * Fixed error handling: when single users are not updateable in bulk mode the exception should not stop the code flow but document the problem in the result. * Better error handling * on error give username, not gitlab numeric userid * Fixed broken check_mode * Update plugins/modules/source_control/gitlab/gitlab_group_members.py Co-authored-by: Felix Fontein <felix@fontein.de> * Change from review Co-authored-by: Max Bidlingmaier <Max-Florian.Bidlingmaier@sap.com> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Zainab Alsaffar <za5775@rit.edu>
2021-08-31 15:07:52 +02:00
state: absent
- name: Add a list of Users to A GitLab Group
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_user: '{{ userlist }}'
access_level: '{{ gitlab_access_level }}'
state: present
- name: Remove a list of Users to A GitLab Group
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_user: '{{ userlist }}'
state: absent
- name: Add a list of Users with Dedicated Access Levels to A GitLab Group
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_users_access: '{{ dedicated_access_users }}'
state: present
- name: Remove a list of Users with Dedicated Access Levels to A GitLab Group
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_users_access: '{{ dedicated_access_users }}'
state: absent
- name: Add a user, remove all others which might be on this access level
gitlab_group_members:
api_url: '{{ gitlab_server_url }}'
api_token: '{{ gitlab_api_access_token }}'
gitlab_group: '{{ gitlab_group_name }}'
gitlab_user: '{{ username }}'
access_level: '{{ gitlab_access_level }}'
pruge_users: '{{ gitlab_access_level }}'
state: present