Ginny Thomas’ Post

I just recently implemented JWT authentication from scratch in FastAPI —  and doing it with TDD taught me something I wouldn't have  learned otherwise. The test I wrote first: def test_login_with_wrong_password_returns_401(client):   response = client.post("/api/v1/auth/login",      json={"email": "user@test.com", "password": "wrongpassword"})   assert response.status_code == 401 Simple. But writing that BEFORE the implementation forced me to  think about the user experience of authentication failure before  thinking about the code. The thing that surprised me most: the `yield` pattern in FastAPI  dependencies. Instead of returning a database session, you yield it  — which means cleanup code runs after the route finishes, even if  it crashes. One pattern, zero connection leaks. Building Tidal — a multi-currency budgeting app — in Python + React  after 4 years of Scala. The mental model shift is real but the  engineering fundamentals are identical. What's the most useful thing TDD has taught you about your own code? #Python #FastAPI #TDD #SoftwareEngineering #OpenAI #Remote

My favourite TDD quote was the inspiration forr my book. At Javaone 2001 Floyd Marinescu said (in his talk), “TDD is neither testing nor development, it’s design”. I love seeing you go on the journey.

To view or add a comment, sign in

Explore content categories