Skip to content

Commit

Permalink
Config coverage upgrade (#898)
Browse files Browse the repository at this point in the history
* Small test config up

* Correct indent
  • Loading branch information
euri10 authored Dec 19, 2020
1 parent debdb64 commit 1841655
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,27 @@ def test_proxy_headers():
assert isinstance(config.loaded_app, ProxyHeadersMiddleware)


def test_app_unimportable():
def test_app_unimportable_module():
config = Config(app="no.such:app")
with pytest.raises(ImportError):
config.load()


def test_app_unimportable_other(caplog):
config = Config(app="tests.test_config:app")
with pytest.raises(SystemExit):
config.load()
error_messages = [
record.message
for record in caplog.records
if record.name == "uvicorn.error" and record.levelname == "ERROR"
]
assert (
'Error loading ASGI app. Attribute "app" not found in module "tests.test_config".' # noqa: E501
== error_messages.pop(0)
)


def test_app_factory():
def create_app():
return asgi_app
Expand Down

0 comments on commit 1841655

Please sign in to comment.