def test_wesp_auth_login(client):
    response = client.post(
        "/api/auth/login",
        json={"login": "admin@compton.example", "password": "Admin1234"},
    )
    assert response.status_code == 200
    body = response.json()
    assert body["status"] == "success"
    assert body.get("access_token")


def test_wesp_auth_check(client):
    login = client.post(
        "/api/v1/auth/login",
        json={"email": "admin@compton.example", "password": "Admin1234"},
    )
    token = login.json()["access_token"]
    response = client.get("/api/auth/check", headers={"Authorization": f"Bearer {token}"})
    assert response.status_code == 200
    body = response.json()
    assert body["status"] == "success"
    assert body["authenticated"] is True
    assert body["user_login"] == "admin@compton.example"
    assert body["is_superuser"] is True
