Skip to content

Commit

Permalink
Add test for GET /proofs
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Nov 15, 2023
1 parent 241551f commit a3227ab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 13 additions & 1 deletion tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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

0 comments on commit a3227ab

Please sign in to comment.