halfapi/tests/cli/test_cli_run.py

34 lines
971 B
Python
Raw Permalink Normal View History

import pytest
2021-11-23 13:53:08 +01:00
from click.testing import CliRunner
from halfapi.cli.cli import cli
import os
from unittest.mock import patch
@pytest.mark.skip
2021-11-23 13:53:08 +01:00
def test_run_noproject(cli_runner):
with cli_runner.isolated_filesystem():
result = cli_runner.invoke(cli, ['config'])
print(result.stdout)
assert result.exit_code == 0
2021-12-07 11:42:02 +01:00
result = cli_runner.invoke(cli, ['run', '--dryrun'])
try:
assert result.exit_code == 0
except AssertionError as exc:
print(result.stdout)
raise exc
2021-11-23 13:53:08 +01:00
"""
def test_run_empty_project(cli_runner):
with cli_runner.isolated_filesystem():
os.mkdir('dummy_domain')
result = cli_runner.invoke(cli, ['run', './dummy_domain'])
assert result.exit_code == 1
def test_run_dummy_project(project_runner):
with patch('uvicorn.run', autospec=True) as runMock:
result = project_runner.invoke(cli, ['run'])
runMock.assert_called_once()
"""