Fix formatting with black

This commit is contained in:
GotthardG
2024-12-16 10:41:56 +01:00
parent 57763970f9
commit a0be71bdfe
26 changed files with 1657 additions and 645 deletions

View File

@@ -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