import pytest
from app import create_app
from models import db as _db
from config import TestConfig


@pytest.fixture(scope="function")
def app():
    """Fresh app + in-memory DB for every test."""
    app = create_app(TestConfig)
    with app.app_context():
        _db.create_all()
        yield app
        _db.session.remove()
        _db.drop_all()


@pytest.fixture
def client(app):
    return app.test_client()


@pytest.fixture
def auth_headers():
    return {"X-API-Key": "test-key", "Content-Type": "application/json"}
