Test to ensure the CLI tester works as intended to allow testing CLI endpoints
()
| 27 | |
| 28 | |
| 29 | def test_cli(): |
| 30 | """Test to ensure the CLI tester works as intended to allow testing CLI endpoints""" |
| 31 | |
| 32 | @hug.cli() |
| 33 | def my_cli_function(): |
| 34 | return "Hello" |
| 35 | |
| 36 | assert hug.test.cli(my_cli_function) == "Hello" |
| 37 | assert hug.test.cli("my_cli_function", api=api) == "Hello" |
| 38 | |
| 39 | # Shouldn't be able to specify both api and module. |
| 40 | with pytest.raises(ValueError): |
| 41 | assert hug.test.cli("my_method", api=api, module=hug) |