diff --git a/backend/tests/test_contact.py b/backend/tests/test_contact.py index b8df0a7..1e26ad0 100644 --- a/backend/tests/test_contact.py +++ b/backend/tests/test_contact.py @@ -4,16 +4,18 @@ from backend.main import app client = TestClient(app) -def authenticate(client): +def authenticate(): + # Simulate login to obtain token response = client.post( - "/auth/login", json={"username": "testuser", "password": "testpassword"} + "/auth/login", json={"username": "testuser", "password": "securepassword"} ) assert response.status_code == 200 return response.json()["access_token"] def test_create_contact_success(): - token = authenticate(client) + # Authenticate and attach token to headers + token = authenticate() headers = {"Authorization": f"Bearer {token}"} response = client.post(