pre-commit-ci-lite[bot]
6 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
3 additions and
3 deletions
-
tests/test_security_http_base.py
|
|
@ -1,7 +1,7 @@ |
|
|
from fastapi import FastAPI, Security, Depends |
|
|
from fastapi import Depends, FastAPI, Security |
|
|
|
|
|
from fastapi.security import HTTPBasic |
|
|
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase |
|
|
from fastapi.security.http import HTTPAuthorizationCredentials, HTTPBase |
|
|
from fastapi.testclient import TestClient |
|
|
from fastapi.testclient import TestClient |
|
|
from fastapi.security import HTTPBasic |
|
|
|
|
|
|
|
|
|
|
|
app = FastAPI() |
|
|
app = FastAPI() |
|
|
|
|
|
|
|
|
@ -55,6 +55,7 @@ def test_openapi_schema(): |
|
|
}, |
|
|
}, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_http_basic_includes_realm(): |
|
|
def test_http_basic_includes_realm(): |
|
|
app = FastAPI() |
|
|
app = FastAPI() |
|
|
security = HTTPBasic(realm="MyRealm") |
|
|
security = HTTPBasic(realm="MyRealm") |
|
|
@ -68,4 +69,3 @@ def test_http_basic_includes_realm(): |
|
|
|
|
|
|
|
|
assert response.status_code == 401 |
|
|
assert response.status_code == 401 |
|
|
assert response.headers["WWW-Authenticate"] == 'Basic realm="MyRealm"' |
|
|
assert response.headers["WWW-Authenticate"] == 'Basic realm="MyRealm"' |
|
|
|
|
|
|