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 e7f9616b39
Rewrite testing system (#119)
The new test system is written with py.test. These tests are more
comprehensive, run faster by an order of magnitude, and are far more
maintainable. The tests themselves conform to PEP8.
2019-02-20 07:48:25 -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_y, paths, name,
supported_commands, supported_configs, supported_switches):
"""Validate introspection category"""
if name:
run = runner(command=yadm_y('introspect', name))
else:
run = runner(command=yadm_y('introspect'))
assert run.success
assert run.err == ''
expected = []
if name == 'commands':
expected = supported_commands
elif name == 'config':
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)