2021-11-23 08:25:09 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from click.testing import CliRunner
|
|
|
|
|
2022-01-04 13:37:37 +00:00
|
|
|
from tutor.__about__ import __version__
|
2021-11-23 08:25:09 +00:00
|
|
|
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)
|
2022-01-04 13:37:37 +00:00
|
|
|
self.assertRegex(result.output, r"cli, version {}\n".format(__version__))
|