Mercurial > code > home > repos > rdferry
diff examples/serve_custom_root_page_test.py @ 5:b34cd6619316
new test. server has to be able to exit between tests.
author | drewp@bigasterisk.com |
---|---|
date | Sat, 16 Mar 2024 12:11:32 -0700 |
parents | |
children | 25538e3ee531 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/serve_custom_root_page_test.py Sat Mar 16 12:11:32 2024 -0700 @@ -0,0 +1,13 @@ +from pathlib import Path + +import pytest + +from examples.run_server_make_request import HttpServer + + +@pytest.mark.asyncio +async def test_http_request_to_subprocess(): + async with HttpServer( + Path('examples/serve_custom_root_page.py')) as http_server: + response = await http_server.get('http://localhost:8005/') + assert (await response.text()) == 'hello world'