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) (#2777)

* add inventory plugin unit test `test_verify_file`

* fix typos in `test_verify_file_bad_config` unit test

(cherry picked from commit f44300cec5)

Co-authored-by: Rémy Keil <remy.keil@gmail.com>
This commit is contained in:
patchback[bot] 2021-06-10 22:26:28 +02:00 committed by GitHub
parent 92ccc6f013
commit ffdef00a6a
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] == {}
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):
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']
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):
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
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):
assert inventory.verify_file('foobar.lxd.yml') is False

View file

@ -21,6 +21,12 @@ def inventory():
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):
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):
assert inventory.verify_file('foobar.stackpath_compute.yml') is False