Skip to content

Commit fb96fd6

Browse files
committed
Improve coverage
1 parent 44e471f commit fb96fd6

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/test_cli.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,38 @@ def test_dev() -> None:
4141
in result.output
4242
)
4343

44+
assert "🐍 single_file_app.py" in result.output
45+
46+
47+
def test_dev_package() -> None:
48+
with changing_dir(assets_path):
49+
with patch.object(uvicorn, "run") as mock_run:
50+
result = runner.invoke(app, ["dev", "package"])
51+
assert result.exit_code == 0, result.output
52+
assert mock_run.called
53+
assert mock_run.call_args
54+
assert mock_run.call_args.kwargs == {
55+
"app": "package:app",
56+
"host": "127.0.0.1",
57+
"port": 8000,
58+
"reload": True,
59+
"workers": None,
60+
"root_path": "",
61+
"proxy_headers": True,
62+
"log_config": get_uvicorn_log_config(),
63+
}
64+
assert "Using import string: package:app" in result.output
65+
assert "Starting development server 🚀" in result.output
66+
assert "Server started at https://127.0.0.1:8000" in result.output
67+
assert "Documentation at https://127.0.0.1:8000/docs" in result.output
68+
assert (
69+
"Running in development mode, for production use: fastapi run"
70+
in result.output
71+
)
72+
73+
assert "📁 package" in result.output
74+
assert "└── 🐍 __init__.py" in result.output
75+
4476

4577
def test_dev_args() -> None:
4678
with changing_dir(assets_path):

0 commit comments

Comments
 (0)