1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2024-10-27 20:34:27 +00:00
TheLocehiliosan_yadm/test/test_introspect.py
Tim Byrne 62b109ad2d
Rename yadm_y -> yadm_cmd
-Y is no longer used when running commands
2020-11-22 17:09:44 -06:00

47 lines
1.1 KiB
Python

"""Test introspect"""
import pytest
@pytest.mark.parametrize(
'name', [
'',
'invalid',
'commands',
'configs',
'repo',
'switches',
])
def test_introspect_category(
runner, yadm_cmd, paths, name,
supported_commands, supported_configs, supported_switches):
"""Validate introspection category"""
if name:
run = runner(command=yadm_cmd('introspect', name))
else:
run = runner(command=yadm_cmd('introspect'))
assert run.success
assert run.err == ''
expected = []
if name == 'commands':
expected = supported_commands
elif name == 'configs':
expected = supported_configs
elif name == 'switches':
expected = supported_switches
# assert values
if name in ('', 'invalid'):
assert run.out == ''
if name == 'repo':
assert run.out.rstrip() == paths.repo
# make sure every expected value is present
for value in expected:
assert value in run.out
# make sure nothing extra is present
if expected:
assert len(run.out.split()) == len(expected)