Nicer pattern for make_app_client() in tests, closes #395

This commit is contained in:
Simon Willison 2020-06-07 14:14:10 -07:00
commit abc7339124
7 changed files with 56 additions and 42 deletions

View file

@ -229,9 +229,9 @@ def test_plugins_asgi_wrapper(app_client):
def test_plugins_extra_template_vars(restore_working_directory):
for client in make_app_client(
with make_app_client(
template_dir=str(pathlib.Path(__file__).parent / "test_templates")
):
) as client:
response = client.get("/-/metadata")
assert response.status == 200
extra_template_vars = json.loads(
@ -254,9 +254,9 @@ def test_plugins_extra_template_vars(restore_working_directory):
def test_plugins_async_template_function(restore_working_directory):
for client in make_app_client(
with make_app_client(
template_dir=str(pathlib.Path(__file__).parent / "test_templates")
):
) as client:
response = client.get("/-/metadata")
assert response.status == 200
extra_from_awaitable_function = (