Debian Codegraph @

ansible_collections/community/general/tests/integration/targets/github_key/tasks/main.yml

raw
1 ---
2 ####################################################################
3 # WARNING: These are designed specifically for Ansible tests #
4 # and should not be used as examples of how to write Ansible roles #
5 ####################################################################
6
7 # Test code for the github_key module.
8 # Copyright (c) Ansible Project
9 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
10 # SPDX-License-Identifier: GPL-3.0-or-later
11
12 - name: Test api_url parameter with GitHub.com
13 community.general.github_key:
14 token: "{{ fake_token }}"
15 name: "{{ test_key_name }}"
16 pubkey: "{{ test_pubkey }}"
17 state: present
18 api_url: "{{ github_api_url }}"
19 register: github_api_result
20 ignore_errors: true
21
22 - name: Assert api_url parameter works with GitHub.com
23 assert:
24 that:
25 - github_api_result is failed
26 - '"Unauthorized" in github_api_result.msg or "401" in github_api_result.msg'
27
28 - name: Test api_url parameter with GitHub Enterprise
29 community.general.github_key:
30 token: "{{ fake_token }}"
31 name: "{{ test_key_name }}"
32 pubkey: "{{ test_pubkey }}"
33 state: present
34 api_url: "{{ enterprise_api_url }}"
35 register: enterprise_api_result
36 ignore_errors: true
37
38 - name: Assert api_url parameter works with GitHub Enterprise
39 assert:
40 that:
41 - enterprise_api_result is failed
42 - '"github.company.com" in enterprise_api_result.msg'
43
44 - name: Test api_url with trailing slash
45 community.general.github_key:
46 token: "{{ fake_token }}"
47 name: "{{ test_key_name }}"
48 pubkey: "{{ test_pubkey }}"
49 state: present
50 api_url: "{{ enterprise_api_url_trailing }}"
51 register: trailing_slash_result
52 ignore_errors: true
53
54 - name: Assert trailing slash is handled correctly
55 assert:
56 that:
57 - trailing_slash_result is failed
58 - '"github.company.com" in trailing_slash_result.msg'