2021-10-29 16:44:03 -04:00
|
|
|
""" Validate task-status options """
|
|
|
|
from click.testing import CliRunner
|
2021-08-18 19:18:15 -04:00
|
|
|
from task_status.task_status import main as task_main
|
2021-08-18 19:40:21 -04:00
|
|
|
from task_status.task_status import __version__ as task_version
|
2021-08-18 19:18:15 -04:00
|
|
|
|
2021-08-18 19:40:21 -04:00
|
|
|
runner = CliRunner()
|
2021-08-18 19:18:15 -04:00
|
|
|
|
|
|
|
|
|
|
|
def test_main():
|
2021-10-29 16:44:03 -04:00
|
|
|
"""Validate the basic command runs with a successful response"""
|
|
|
|
response = runner.invoke(task_main)
|
|
|
|
assert response.exit_code == 0
|
2021-08-18 19:40:21 -04:00
|
|
|
|
|
|
|
|
|
|
|
def test_version():
|
2021-10-29 16:44:03 -04:00
|
|
|
"""Verify that --version outputs the version and it matches
|
|
|
|
what the code says it should be"""
|
2021-08-18 19:40:21 -04:00
|
|
|
response = runner.invoke(task_main, ["--version"])
|
|
|
|
assert response.exit_code == 0
|
|
|
|
assert task_version in response.output
|
|
|
|
|
|
|
|
|
|
|
|
def test_uuid():
|
2021-10-29 16:44:03 -04:00
|
|
|
"""Validate the --uuid option returns successfully"""
|
2021-08-18 19:40:21 -04:00
|
|
|
response = runner.invoke(task_main, ["--uuid"])
|
|
|
|
assert response.exit_code == 0
|
2021-08-18 20:07:04 -04:00
|
|
|
|
|
|
|
|
2021-08-24 10:27:45 -04:00
|
|
|
def test_sort():
|
2021-10-29 16:44:03 -04:00
|
|
|
"""Validate --sort returns successfully"""
|
2021-08-24 10:27:45 -04:00
|
|
|
response = runner.invoke(task_main, ["--sort"])
|
|
|
|
assert response.exit_code == 0
|
|
|
|
|
|
|
|
|
|
|
|
def test_header():
|
2021-10-29 16:44:03 -04:00
|
|
|
"""Validate --header returns successfully"""
|
2021-08-24 10:27:45 -04:00
|
|
|
response = runner.invoke(task_main, ["--header"])
|
|
|
|
assert response.exit_code == 0
|
|
|
|
|
|
|
|
|
2021-08-18 20:07:04 -04:00
|
|
|
def test_help():
|
2021-10-29 16:44:03 -04:00
|
|
|
"""Validate --help returns successfully"""
|
2021-08-18 20:07:04 -04:00
|
|
|
response = runner.invoke(task_main, ["--help"])
|
|
|
|
assert response.exit_code == 0
|
2021-10-29 16:44:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
def test_invalid_option():
|
|
|
|
"""Validate pasing a bad option returns an error"""
|
|
|
|
# check that task fails successfully!"
|
|
|
|
response = runner.invoke(task_main, ["--invalid"])
|
|
|
|
assert response.exit_code == 2
|