mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Merge pull request #3076 from ryanpetrello/test-data-cleanup
move awx.main.utils.ansible tests data into the correct location Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
@@ -1,32 +0,0 @@
|
|||||||
import os
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from awx.main.utils.ansible import could_be_playbook, could_be_inventory
|
|
||||||
|
|
||||||
HERE, _ = os.path.split(__file__)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('filename', os.listdir(os.path.join(HERE, 'playbooks', 'valid')))
|
|
||||||
def test_could_be_playbook(filename):
|
|
||||||
path = os.path.join(HERE, 'playbooks', 'valid')
|
|
||||||
assert could_be_playbook(HERE, path, filename).endswith(filename)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('filename', os.listdir(os.path.join(HERE, 'playbooks', 'invalid')))
|
|
||||||
def test_is_not_playbook(filename):
|
|
||||||
path = os.path.join(HERE, 'playbooks', 'invalid')
|
|
||||||
assert could_be_playbook(HERE, path, filename) is None
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('filename', os.listdir(os.path.join(HERE, 'inventories', 'valid')))
|
|
||||||
def test_could_be_inventory(filename):
|
|
||||||
path = os.path.join(HERE, 'inventories', 'valid')
|
|
||||||
assert could_be_inventory(HERE, path, filename).endswith(filename)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('filename', os.listdir(os.path.join(HERE, 'inventories', 'invalid')))
|
|
||||||
def test_is_not_inventory(filename):
|
|
||||||
path = os.path.join(HERE, 'inventories', 'invalid')
|
|
||||||
assert could_be_inventory(HERE, path, filename) is None
|
|
||||||
33
awx/main/tests/unit/utils/test_ansible.py
Normal file
33
awx/main/tests/unit/utils/test_ansible.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from awx.main.tests import data
|
||||||
|
from awx.main.utils.ansible import could_be_playbook, could_be_inventory
|
||||||
|
|
||||||
|
DATA = os.path.join(os.path.dirname(data.__file__), 'ansible_utils')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('filename', os.listdir(os.path.join(DATA, 'playbooks', 'valid')))
|
||||||
|
def test_could_be_playbook(filename):
|
||||||
|
path = os.path.join(DATA, 'playbooks', 'valid')
|
||||||
|
assert could_be_playbook(DATA, path, filename).endswith(filename)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('filename', os.listdir(os.path.join(DATA, 'playbooks', 'invalid')))
|
||||||
|
def test_is_not_playbook(filename):
|
||||||
|
path = os.path.join(DATA, 'playbooks', 'invalid')
|
||||||
|
assert could_be_playbook(DATA, path, filename) is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('filename', os.listdir(os.path.join(DATA, 'inventories', 'valid')))
|
||||||
|
def test_could_be_inventory(filename):
|
||||||
|
path = os.path.join(DATA, 'inventories', 'valid')
|
||||||
|
assert could_be_inventory(DATA, path, filename).endswith(filename)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('filename', os.listdir(os.path.join(DATA, 'inventories', 'invalid')))
|
||||||
|
def test_is_not_inventory(filename):
|
||||||
|
path = os.path.join(DATA, 'inventories', 'invalid')
|
||||||
|
assert could_be_inventory(DATA, path, filename) is None
|
||||||
Reference in New Issue
Block a user