1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

add inventory plugin unit test test_verify_file (#2773)

* add inventory plugin unit test `test_verify_file`

* fix typos in `test_verify_file_bad_config` unit test
This commit is contained in:
Rémy Keil 2021-06-10 22:05:04 +02:00 committed by GitHub
parent 1e968bce27
commit f44300cec5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 2 deletions

View file

@ -37,5 +37,11 @@ def test_init_cache(inventory):
assert inventory._cache[inventory.cache_key] == {} assert inventory._cache[inventory.cache_key] == {}
def test_verify_file(tmp_path, inventory):
file = tmp_path / "foobar.cobbler.yml"
file.touch()
assert inventory.verify_file(str(file)) is True
def test_verify_file_bad_config(inventory): def test_verify_file_bad_config(inventory):
assert inventory.verify_file('foobar.cobber.yml') is False assert inventory.verify_file('foobar.cobbler.yml') is False

View file

@ -74,5 +74,11 @@ def test_conig_query_options(inventory):
assert tags == ['web-server'] assert tags == ['web-server']
def test_verify_file(tmp_path, inventory):
file = tmp_path / "foobar.linode.yml"
file.touch()
assert inventory.verify_file(str(file)) is True
def test_verify_file_bad_config(inventory): def test_verify_file_bad_config(inventory):
assert inventory.verify_file('foobar.linde.yml') is False assert inventory.verify_file('foobar.linode.yml') is False

View file

@ -51,6 +51,12 @@ def inventory():
return inv return inv
def test_verify_file(tmp_path, inventory):
file = tmp_path / "foobar.lxd.yml"
file.touch()
assert inventory.verify_file(str(file)) is True
def test_verify_file_bad_config(inventory): def test_verify_file_bad_config(inventory):
assert inventory.verify_file('foobar.lxd.yml') is False assert inventory.verify_file('foobar.lxd.yml') is False

View file

@ -21,6 +21,12 @@ def inventory():
return r return r
def test_verify_file(tmp_path, inventory):
file = tmp_path / "foobar.proxmox.yml"
file.touch()
assert inventory.verify_file(str(file)) is True
def test_verify_file_bad_config(inventory): def test_verify_file_bad_config(inventory):
assert inventory.verify_file('foobar.proxmox.yml') is False assert inventory.verify_file('foobar.proxmox.yml') is False

View file

@ -66,6 +66,12 @@ def test_get_stack_slugs(inventory):
] ]
def test_verify_file(tmp_path, inventory):
file = tmp_path / "foobar.stackpath_compute.yml"
file.touch()
assert inventory.verify_file(str(file)) is True
def test_verify_file_bad_config(inventory): def test_verify_file_bad_config(inventory):
assert inventory.verify_file('foobar.stackpath_compute.yml') is False assert inventory.verify_file('foobar.stackpath_compute.yml') is False