CourseAI Engineering: The Complete Course · Module 10: Backend Engineering · part 79 of 105
Part 79 · Module 10: Backend Engineering

Lesson 5: Tests that catch the day-31 bug

20 min read·
Module 10 · Lesson 5 · About 45 minutes · Needs: Module 1, Lesson 3 (pytest basics) and Lesson 1 of this module (routes, Pydantic models, dependencies)

The situation

Dev has two routes: one says whether an order can be returned, one asks the model to answer the customer. Both rest on the 30-day rule, and someone will refactor it next week. Dev wants tests that run in seconds, need no API key, and fail if the rule shifts by a day.

The running example is Aisha Rahman's order 6150, GlowLine bulbs delivered on 4 October 2026. Day 30, 3 November, is in. Day 31, 4 November, is out.

The rest of this course is yours to keep

This course is bought on its own, once, and stays readable afterwards, including the parts added to it later.

Or open everything with a plan