mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-04 15:13:26 -04:00
🎨 Fix missing format
This commit is contained in:
@@ -17,7 +17,7 @@ fake_users_db = {
|
||||
"email": "alice@example.com",
|
||||
"hashed_password": "fakehashedsecret2",
|
||||
"disabled": True,
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -120,7 +120,9 @@ def test_login():
|
||||
|
||||
|
||||
def test_login_incorrect_password():
|
||||
response = client.post("/token", data={"username": "johndoe", "password": "incorrect"})
|
||||
response = client.post(
|
||||
"/token", data={"username": "johndoe", "password": "incorrect"}
|
||||
)
|
||||
assert response.status_code == 400
|
||||
assert response.json() == {"detail": "Incorrect username or password"}
|
||||
|
||||
@@ -154,6 +156,7 @@ def test_incorrect_token():
|
||||
assert response.status_code == 400
|
||||
assert response.json() == {"detail": "Invalid authentication credentials"}
|
||||
|
||||
|
||||
def test_incorrect_token_type():
|
||||
response = client.get(
|
||||
"/users/me", headers={"Authorization": "Notexistent testtoken"}
|
||||
@@ -161,6 +164,7 @@ def test_incorrect_token_type():
|
||||
assert response.status_code == 403
|
||||
assert response.json() == {"detail": "Not authenticated"}
|
||||
|
||||
|
||||
def test_inactive_user():
|
||||
response = client.get("/users/me", headers={"Authorization": "Bearer alice"})
|
||||
assert response.status_code == 400
|
||||
|
||||
Reference in New Issue
Block a user