mirror of
https://github.com/ansible-collections/hetzner.hcloud.git
synced 2026-02-04 08:01:49 +00:00
* test: fix hcloud_location_info with wrong id test * chore: cleanup hcloud_location_info tests * fix: error on location_info invalid id
55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
# Copyright: (c) 2019, Hetzner Cloud GmbH <info@hetzner-cloud.de>
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
---
|
|
- name: Gather hcloud_location_info
|
|
hetzner.hcloud.hcloud_location_info:
|
|
register: result
|
|
- name: Verify hcloud_location_info
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_location_info | list | count >= 5
|
|
|
|
- name: Gather hcloud_location_info in check mode
|
|
hetzner.hcloud.hcloud_location_info:
|
|
check_mode: true
|
|
register: result
|
|
- name: Verify hcloud_location_info in check mode
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_location_info | list | count >= 5
|
|
|
|
- name: Gather hcloud_location_info with correct name
|
|
hetzner.hcloud.hcloud_location_info:
|
|
name: "{{ hcloud_location_name }}"
|
|
register: result
|
|
- name: Verify hcloud_location_info with correct name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_location_info | selectattr('name', 'equalto', '{{ hcloud_location_name }}') | list | count == 1
|
|
|
|
- name: Gather hcloud_location_info with wrong name
|
|
hetzner.hcloud.hcloud_location_info:
|
|
name: "{{ hcloud_location_name }}1"
|
|
register: result
|
|
- name: Verify hcloud_location_info with wrong name
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_location_info | list | count == 0
|
|
|
|
- name: Gather hcloud_location_info with correct id
|
|
hetzner.hcloud.hcloud_location_info:
|
|
id: "{{ hcloud_location_id }}"
|
|
register: result
|
|
- name: Verify hcloud_location_info with correct id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_location_info | selectattr('name', 'equalto', '{{ hcloud_location_name }}') | list | count == 1
|
|
|
|
- name: Gather hcloud_location_info with wrong id
|
|
hetzner.hcloud.hcloud_location_info:
|
|
id: 4711
|
|
register: result
|
|
- name: Verify hcloud_location_info with wrong id
|
|
ansible.builtin.assert:
|
|
that:
|
|
- result.hcloud_location_info | list | count == 0
|