"""Tests for API key authentication."""

from __future__ import annotations


def test_missing_api_key(client):
    resp = client.get("/receipts")
    assert resp.status_code == 422


def test_invalid_api_key(client):
    resp = client.get("/receipts", headers={"X-API-Key": "pt_live_invalid"})
    assert resp.status_code == 401
    assert "Invalid API key" in resp.json()["detail"]


def test_valid_api_key(client, auth_headers):
    resp = client.get("/receipts", headers=auth_headers)
    assert resp.status_code == 200
