Sanic app without any endpoints fails during routing
LiraNuna opened this issue · comments
LiraNuna commented
import pytest
from sanic import Sanic
from sanic_testing import TestManager
@pytest.fixture
def app():
sanic_app = Sanic(__name__)
TestManager(sanic_app)
return sanic_app
@pytest.mark.asyncio
async def test_not_found(app):
request, response = await app.asgi_client.get("/not-a-known-endpoint")
assert response.status == 404
This test will fail with an exception related to routing when ran.
Adam Hopkins commented
This is true. Not related to sanic-testing though. A Sanic application MUST have at least one endpoint before it can be started.
LiraNuna commented
I see. Thanks for confirming my suspicion. Closing.