mirror of https://github.com/ansible/ansible.git
Add testcases for github_issue (#26309)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>pull/28836/merge
parent
c9b74a3af3
commit
a2c8481395
@ -0,0 +1 @@
|
||||
posix/ci/group1
|
@ -0,0 +1,69 @@
|
||||
# Test code for the github_issue module.
|
||||
# (c) 2017, Abhijeet Kasurde <akasurde@redhat.com>
|
||||
|
||||
# This file is part of Ansible
|
||||
#
|
||||
# Ansible is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# Ansible is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# Testcase 0001: Check if dependency is installed
|
||||
- name: Check if github3.py is installed or not
|
||||
github_issue:
|
||||
organization: "{{ organization }}"
|
||||
repo: "{{ repo }}"
|
||||
issue: "{{ non_existent_issue }}"
|
||||
action: get_status
|
||||
register: lib_missing
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "{{ lib_missing.failed == True }}"
|
||||
- "{{ lib_missing.changed == False }}"
|
||||
- "{{ 'Missing required github3 module.' in lib_missing.msg }}"
|
||||
|
||||
- name: make sure github3.py is installed
|
||||
pip:
|
||||
name: github3.py
|
||||
state: latest
|
||||
|
||||
# Testcase 0002: Check if issue exists
|
||||
- name: Check if GitHub issue is closed or not
|
||||
github_issue:
|
||||
organization: "{{ organization }}"
|
||||
repo: "{{ repo }}"
|
||||
issue: "{{ issue }}"
|
||||
action: get_status
|
||||
register: get_status_0002
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "{{ get_status_0002.changed == True }}"
|
||||
- "{{ get_status_0002.issue_status == 'closed' }}"
|
||||
|
||||
# Testcase 0003: Check non-existent issue status
|
||||
- name: Check if GitHub issue is closed or not
|
||||
github_issue:
|
||||
organization: "{{ organization }}"
|
||||
repo: "{{ repo }}"
|
||||
issue: "{{ non_existent_issue }}"
|
||||
action: get_status
|
||||
register: get_status_0003
|
||||
ignore_errors: True
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- "{{ get_status_0003.changed == False }}"
|
||||
- "{{ get_status_0003.failed == True }}"
|
||||
- "{{ 'Failed' in get_status_0003.msg }}"
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
|
||||
issue: 23642
|
||||
non_existent_issue: 1111111
|
||||
organization: ansible
|
||||
repo: ansible
|
Loading…
Reference in New Issue