Skip to content

Commit

Permalink
fix: Fix tests after adding type annotations to Middleware.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paweł Rubin committed Dec 18, 2023
1 parent 162440c commit 3819c8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion tests/middleware/test_middleware.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from starlette.middleware import Middleware
from starlette.types import ASGIApp


class CustomMiddleware:
pass
def __init__(self, app: ASGIApp) -> None:
self.app = app


def test_middleware_repr():
Expand Down
4 changes: 2 additions & 2 deletions tests/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from starlette.endpoints import HTTPEndpoint
from starlette.middleware import Middleware
from starlette.middleware.authentication import AuthenticationMiddleware
from starlette.requests import Request
from starlette.requests import HTTPConnection
from starlette.responses import JSONResponse
from starlette.routing import Route, WebSocketRoute
from starlette.websockets import WebSocketDisconnect
Expand Down Expand Up @@ -327,7 +327,7 @@ def test_authentication_redirect(test_client_factory):
assert response.json() == {"authenticated": True, "user": "tomchristie"}


def on_auth_error(request: Request, exc: Exception):
def on_auth_error(request: HTTPConnection, exc: AuthenticationError):
return JSONResponse({"error": str(exc)}, status_code=401)


Expand Down

0 comments on commit 3819c8e

Please sign in to comment.