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_project_badge/tasks/main.yml
Felix Fontein 11c7611ced
More true/false normalization (#6152)
* More true/false normalization.

* Boolean do not need explicit choices.

* One more.

* Fix type argument.
2023-03-06 23:02:24 +01:00

214 lines
6.1 KiB
YAML

---
####################################################################
# WARNING: These are designed specifically for Ansible tests #
# and should not be used as examples of how to write Ansible roles #
####################################################################
# Copyright (c) 2022, Guillaume MARTINEZ <lunik@tiwabbit.fr>
# 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 libs
pip:
name: python-gitlab
state: present
- name: Create {{ gitlab_project_name }}
gitlab_project:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}"
initialize_with_readme: true
state: present
- name: Create Badge (check)
check_mode: true
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: present
link_url: "{{ gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_create_check_task
- ansible.builtin.debug:
var: gitlab_badge_create_check_task
- name: Check module call result
assert:
that:
- gitlab_badge_create_check_task.changed
- not gitlab_badge_create_check_task.failed
- name: Create Badge
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: present
link_url: "{{ gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_create_task
- ansible.builtin.debug:
var: gitlab_badge_create_task
- name: Check module call result
assert:
that:
- gitlab_badge_create_task.changed
- not gitlab_badge_create_task.failed
- name: Create Badge (confirmation)
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: present
link_url: "{{ gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_create_confirmation_task
- ansible.builtin.debug:
var: gitlab_badge_create_confirmation_task
- name: Check module call result
assert:
that:
- not gitlab_badge_create_confirmation_task.changed
- not gitlab_badge_create_confirmation_task.failed
- name: Update Badge (check)
check_mode: true
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: present
link_url: "{{ updated_gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_update_check_task
- ansible.builtin.debug:
var: gitlab_badge_update_check_task
- name: Check module call result
assert:
that:
- gitlab_badge_update_check_task.changed
- not gitlab_badge_update_check_task.failed
- name: Update Badge
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: present
link_url: "{{ updated_gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_update_task
- ansible.builtin.debug:
var: gitlab_badge_update_task
- name: Check module call result
assert:
that:
- gitlab_badge_update_task.changed
- not gitlab_badge_update_task.failed
- name: Update Badge (confirmation)
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: present
link_url: "{{ updated_gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_update_confirmation_task
- ansible.builtin.debug:
var: gitlab_badge_update_confirmation_task
- name: Check module call result
assert:
that:
- not gitlab_badge_update_confirmation_task.changed
- not gitlab_badge_update_confirmation_task.failed
- name: Delete Badge (check)
check_mode: true
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: absent
link_url: "{{ updated_gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_delete_check_task
- ansible.builtin.debug:
var: gitlab_badge_delete_check_task
- name: Check module call result
assert:
that:
- gitlab_badge_delete_check_task.changed
- not gitlab_badge_delete_check_task.failed
- name: Delete Badge
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: absent
link_url: "{{ updated_gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_delete_task
- ansible.builtin.debug:
var: gitlab_badge_delete_task
- name: Check module call result
assert:
that:
- gitlab_badge_delete_task.changed
- not gitlab_badge_delete_task.failed
- name: Delete Badge (confirmation)
gitlab_project_badge:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
project: "{{ gitlab_project_name }}"
state: absent
link_url: "{{ updated_gitlab_badge_link_url }}"
image_url: "{{ gitlab_badge_image_url }}"
register: gitlab_badge_delete_confirmation_task
- ansible.builtin.debug:
var: gitlab_badge_delete_confirmation_task
- name: Check module call result
assert:
that:
- not gitlab_badge_delete_confirmation_task.changed
- not gitlab_badge_delete_confirmation_task.failed
- name: Clean up {{ gitlab_project_name }}
gitlab_project:
api_url: "{{ gitlab_api_url }}"
validate_certs: false
api_token: "{{ gitlab_api_token }}"
name: "{{ gitlab_project_name }}"
state: absent