Would be nice to have some easy, out-of-the-box implementations that work well with how you would typically test an integration that this Fief client ships with (FastAPI, Flask, or the library behind a Python CLI). This could even completely elide Fief in the test scenario where I want to just inject fake auth data (typically, in testing I don't necessarily care about using my real auth service data, which is separate anyways). Still thinking through what would be best for this, this is my sketch (I am using it with a few FastAPI services and a SDK/CLI python package)
FastAPI testing:
# `tests/conftest.py`
import pytest
from fief_client.integrations.fastapi import MockFiefAuth
from myapp import app, auth
@pytest.fixture()
def client():
# Adapted from https://sqlmodel.tiangolo.com/tutorial/fastapi/tests/
app.dependency_overrides[auth] = MockFiefAuth()
yield TestClient(app)
app.dependency_overrides.clear()
For CLI testing, I'm not sure I have a well-formed need yet, but it might be good to implement something useful with how Click does testing
Would be nice to have some easy, out-of-the-box implementations that work well with how you would typically test an integration that this Fief client ships with (FastAPI, Flask, or the library behind a Python CLI). This could even completely elide Fief in the test scenario where I want to just inject fake auth data (typically, in testing I don't necessarily care about using my real auth service data, which is separate anyways). Still thinking through what would be best for this, this is my sketch (I am using it with a few FastAPI services and a SDK/CLI python package)
FastAPI testing:
For CLI testing, I'm not sure I have a well-formed need yet, but it might be good to implement something useful with how Click does testing