Serverless FastAPI Testing: Use Moto and Just Mock It!

Serverless FastAPI Testing: Use Moto and Just Mock It!

In my previous blog post Serverless FastAPI Development: Building Player FC API on AWS, we explored creating and deploying a FastAPI application on AWS. In this blog post we’ll take a look at testing our app locally.

We write tests to prove that our code works as designed, however since our code interacts with cloud services it’s somewhat of a challenge to mock tests to the cloud without actually making api calls that traverse the internet, well that is unless you use Moto.

Moto is a Python library that mocks AWS services, allowing you to test without making real API calls.

Read more
Serverless FastAPI Development: Building Player FC API on AWS

Serverless FastAPI Development: Building Player FC API on AWS

It’s been a while since I’ve had the opportunity to build something simple, interesting and modern. Towards the backend of 2024 I stumbled across FastAPI and got excited, whilst I’ve built internal APIs at work before, I hadn’t yet created anything public facing.

Hello FastAPI!

FastAPI is a modern, powerful framework for building APIs with Python and it seemed perfect for what I wanted to build, an API for basic football player info. I initially dubbed it “Jugador FC” before settling for “Player FC API”.

“Some say ‘No player is bigger than the club.’ Let’s be real, modern day fans care more about players than the actual team most of the time.”

In this blog post I’ll walk you through how I built it, from local development all the way to deploying it on AWS.

Read more