diff --git a/.env b/.env index a3f34aef..f97efe32 100644 --- a/.env +++ b/.env @@ -18,9 +18,9 @@ SENTRY_DNS= LOG_LEVEL=DEBUG # Postgres database -POSTGRES_DB=postgres -POSTGRES_USER=postgres -POSTGRES_PASSWORD=postgres +POSTGRES_DB=open_prices +POSTGRES_USER=open_prices_team +POSTGRES_PASSWORD=password # Host is postgres, as we're using docker and the service name is "postgres" -POSTGRES_HOST=postgres +POSTGRES_HOST=localhost POSTGRES_PORT=5432 diff --git a/tests/test_api.py b/tests/test_api.py index c99dcdb9..182b39c6 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -64,7 +64,7 @@ def test_hello(): assert response.status_code == 200 -def test_create_price_must_be_authenticated(user, db=override_get_db()): +def test_create_price(user, db=override_get_db()): # without authentication response = client.post( "/prices", @@ -126,3 +126,15 @@ def test_get_prices_filters(): response = client.get("/prices?date=2023-10-31") assert response.status_code == 200 assert len(response.json()["items"]) == 1 + + +def test_get_proofs(user): + # without authentication + response = client.get("/proofs") + assert response.status_code == 401 + # with authentication + response = client.get( + "/proofs", + headers={"Authorization": f"Bearer {user.token}"}, + ) + assert response.status_code == 200