6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-12-14 06:58:21 +00:00
tutor/tests/commands/test_cli.py
Régis Behmo 97f7d5a1e7 fix: unit tests in nightly
Unit tests were breaking in nightly branch.
2022-01-04 14:37:37 +01:00

28 lines
871 B
Python

import unittest
from click.testing import CliRunner
from tutor.__about__ import __version__
from tutor.commands.cli import cli, print_help
class CliTests(unittest.TestCase):
def test_help(self) -> None:
runner = CliRunner()
result = runner.invoke(print_help)
self.assertEqual(0, result.exit_code)
self.assertIsNone(result.exception)
def test_cli_help(self) -> None:
runner = CliRunner()
result = runner.invoke(cli, ["--help"])
self.assertEqual(0, result.exit_code)
self.assertIsNone(result.exception)
def test_cli_version(self) -> None:
runner = CliRunner()
result = runner.invoke(cli, ["--version"])
self.assertEqual(0, result.exit_code)
self.assertIsNone(result.exception)
self.assertRegex(result.output, r"cli, version {}\n".format(__version__))