Fix formatting with black
This commit is contained in:
@@ -7,20 +7,26 @@ client = TestClient(app)
|
||||
|
||||
|
||||
def test_login_success():
|
||||
response = client.post("/auth/token/login", data={"username": "testuser", "password": "testpass"})
|
||||
response = client.post(
|
||||
"/auth/token/login", data={"username": "testuser", "password": "testpass"}
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert "access_token" in response.json()
|
||||
|
||||
|
||||
def test_login_failure():
|
||||
response = client.post("/auth/token/login", data={"username": "wrong", "password": "wrongpass"})
|
||||
response = client.post(
|
||||
"/auth/token/login", data={"username": "wrong", "password": "wrongpass"}
|
||||
)
|
||||
assert response.status_code == 401
|
||||
assert response.json() == {"detail": "Incorrect username or password"}
|
||||
|
||||
|
||||
def test_protected_route():
|
||||
# Step 1: Login
|
||||
response = client.post("/auth/token/login", data={"username": "testuser", "password": "testpass"})
|
||||
response = client.post(
|
||||
"/auth/token/login", data={"username": "testuser", "password": "testpass"}
|
||||
)
|
||||
token = response.json()["access_token"]
|
||||
|
||||
# Step 2: Access protected route
|
||||
|
||||
Reference in New Issue
Block a user