fix(test): Fixes for "TestClient" changes

Seems that client is optional according to the ASGI spec.
https://asgi.readthedocs.io/en/latest/specs/www.html

With Starlette 0.35 the TestClient connection  scope is None for "client".
https://github.com/encode/starlette/pull/2377

Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
moson 2024-01-19 16:37:42 +01:00
parent 22e1577324
commit 2fcd793a58
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
8 changed files with 29 additions and 16 deletions

View file

@ -67,7 +67,7 @@ def invalid_password(
def is_banned(request: Request = None, **kwargs) -> None:
host = request.client.host
host = util.get_client_ip(request)
exists = db.query(models.Ban, models.Ban.IPAddress == host).exists()
if db.query(exists).scalar():
raise ValidationError(