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:
parent
1e968bce27
commit
f44300cec5
5 changed files with 32 additions and 2 deletions
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue