44from unittest .mock import patch
55
66import uvicorn
7- from typer .testing import CliRunner
8-
97from fastapi_cli .cli import app
108from fastapi_cli .utils .cli import get_uvicorn_log_config
9+ from typer .testing import CliRunner
10+
1111from tests .utils import changing_dir
1212
1313runner = CliRunner ()
@@ -83,6 +83,12 @@ def test_dev_package() -> None:
8383 "workers" : None ,
8484 "root_path" : "" ,
8585 "proxy_headers" : True ,
86+ "ws" : "auto" ,
87+ "ws_max_size" : 16777216 ,
88+ "ws_max_queue" : 32 ,
89+ "ws_ping_interval" : 20.0 ,
90+ "ws_ping_timeout" : 20.0 ,
91+ "ws_per_message_deflate" : True ,
8692 "forwarded_allow_ips" : None ,
8793 "log_config" : get_uvicorn_log_config (),
8894 }
@@ -172,6 +178,12 @@ def test_dev_env_vars() -> None:
172178 "workers" : None ,
173179 "root_path" : "" ,
174180 "proxy_headers" : True ,
181+ "ws" : "auto" ,
182+ "ws_max_size" : 16777216 ,
183+ "ws_max_queue" : 32 ,
184+ "ws_ping_interval" : 20.0 ,
185+ "ws_ping_timeout" : 20.0 ,
186+ "ws_per_message_deflate" : True ,
175187 "forwarded_allow_ips" : None ,
176188 "log_config" : get_uvicorn_log_config (),
177189 }
@@ -210,6 +222,12 @@ def test_dev_env_vars_and_args() -> None:
210222 "workers" : None ,
211223 "root_path" : "" ,
212224 "proxy_headers" : True ,
225+ "ws" : "auto" ,
226+ "ws_max_size" : 16777216 ,
227+ "ws_max_queue" : 32 ,
228+ "ws_ping_interval" : 20.0 ,
229+ "ws_ping_timeout" : 20.0 ,
230+ "ws_per_message_deflate" : True ,
213231 "forwarded_allow_ips" : None ,
214232 "log_config" : get_uvicorn_log_config (),
215233 }
@@ -289,6 +307,12 @@ def test_run_trust_proxy() -> None:
289307 "workers" : None ,
290308 "root_path" : "" ,
291309 "proxy_headers" : True ,
310+ "ws" : "auto" ,
311+ "ws_max_size" : 16777216 ,
312+ "ws_max_queue" : 32 ,
313+ "ws_ping_interval" : 20.0 ,
314+ "ws_ping_timeout" : 20.0 ,
315+ "ws_per_message_deflate" : True ,
292316 "forwarded_allow_ips" : "*" ,
293317 "log_config" : get_uvicorn_log_config (),
294318 }
@@ -376,6 +400,12 @@ def test_run_env_vars() -> None:
376400 "workers" : None ,
377401 "root_path" : "" ,
378402 "proxy_headers" : True ,
403+ "ws" : "auto" ,
404+ "ws_max_size" : 16777216 ,
405+ "ws_max_queue" : 32 ,
406+ "ws_ping_interval" : 20.0 ,
407+ "ws_ping_timeout" : 20.0 ,
408+ "ws_per_message_deflate" : True ,
379409 "forwarded_allow_ips" : None ,
380410 "log_config" : get_uvicorn_log_config (),
381411 }
@@ -410,6 +440,12 @@ def test_run_env_vars_and_args() -> None:
410440 "workers" : None ,
411441 "root_path" : "" ,
412442 "proxy_headers" : True ,
443+ "ws" : "auto" ,
444+ "ws_max_size" : 16777216 ,
445+ "ws_max_queue" : 32 ,
446+ "ws_ping_interval" : 20.0 ,
447+ "ws_ping_timeout" : 20.0 ,
448+ "ws_per_message_deflate" : True ,
413449 "forwarded_allow_ips" : None ,
414450 "log_config" : get_uvicorn_log_config (),
415451 }
@@ -523,6 +559,12 @@ def test_dev_with_import_string() -> None:
523559 "workers" : None ,
524560 "root_path" : "" ,
525561 "proxy_headers" : True ,
562+ "ws" : "auto" ,
563+ "ws_max_size" : 16777216 ,
564+ "ws_max_queue" : 32 ,
565+ "ws_ping_interval" : 20.0 ,
566+ "ws_ping_timeout" : 20.0 ,
567+ "ws_per_message_deflate" : True ,
526568 "log_config" : get_uvicorn_log_config (),
527569 }
528570 assert "Using import string: single_file_app:api" in result .output
@@ -545,6 +587,12 @@ def test_run_with_import_string() -> None:
545587 "workers" : None ,
546588 "root_path" : "" ,
547589 "proxy_headers" : True ,
590+ "ws" : "auto" ,
591+ "ws_max_size" : 16777216 ,
592+ "ws_max_queue" : 32 ,
593+ "ws_ping_interval" : 20.0 ,
594+ "ws_ping_timeout" : 20.0 ,
595+ "ws_per_message_deflate" : True ,
548596 "log_config" : get_uvicorn_log_config (),
549597 }
550598 assert "Using import string: single_file_app:app" in result .output
0 commit comments