mirror of https://github.com/tiangolo/fastapi.git
🎨 Fix missing format
This commit is contained in:
parent
804ec460fc
commit
c3e5e65093
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue