Urgent.News

What's breaking now, across thousands of outlets.

Tech

FastAPI: test emails with one mailbox per run

Cuando una API envía un email de verificación, el test suele parecer sencillo: crear usuario, esperar el mensaje y abrir el enlace. El problema aparece cuando varios tests comparten el mismo buzón. Un mensaje viejo puede pasar por nuevo, un reintento puede leer el token de otra ejecución y el fallo termina siendo dificil de reproducir. En proyectos con FastAPI he encontrado una solución muy…

Translated from Spanish Read in Spanish

When testing APIs that send verification emails, problems arise when multiple tests share the same inbox, causing old messages to be mistaken for new ones or tokens to be incorrectly read. To solve this, a unique inbox and correlation identifier should be created for each test execution, along with a clear expiration date. A proposed solution involves creating a "fixture" that guarantees a unique identity, limited reading of messages, idempotent consumption, and expiration.

An example of a simple fixture for FastAPI is provided, which creates a unique inbox for each test and ensures that it is deleted after the test, even if an assertion fails. This approach helps prevent issues with test failures and makes it easier to debug and maintain tests.

Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Stop Calling an Agent Run “Done”: Model Delivery, Acceptance, Merge, and Deployment Separately

An agent says the task is finished. A branch exists. CI is green. The ticket moves to Done. Those four facts often arrive close together, but they are not the same fact.

  • Separate states for intent, review, integration, and deployment
  • Named actors: requester, task owner, runner, reviewer, repository maintainer, release owner
  • Workflow: draft → open → claimed → delivered → accepted

A hold-and-release queue for orders waiting on paperwork

Every fulfillment system eventually meets the order that cannot ship for a boring reason. The battery datasheet has not arrived. The commercial invoice lists a country of origin the buyer disputes.

  • FulfillNexa's system assigns hold codes, owners, timestamps, expiries to orders
  • Two checkpoints prevent unnecessary delays before shipping
  • Expiration dates create clear decision points for late documents

The coffee log, rebuilt in .NET

The coffee log, rebuilt in .NET Back in June I wrote about my coffee machine writing my blog . Smart plug watches the coffee machine, Raspberry Pi watches the plug, bit of Python tells Umbraco I've…

  • Author replaces Python script with .NET application for coffee machine
  • Python script difficult to maintain after Pi upgrade to 64-bit model
  • JSON file sink and replay mode enable data analysis and testing

More from Friday 2 October →