Book Image

Building Serverless Microservices in Python

By : Richard Takashi Freeman
Book Image

Building Serverless Microservices in Python

By: Richard Takashi Freeman

Overview of this book

Over the last few years, there has been a massive shift from monolithic architecture to microservices, thanks to their small and independent deployments that allow increased flexibility and agile delivery. Traditionally, virtual machines and containers were the principal mediums for deploying microservices, but they involved a lot of operational effort, configuration, and maintenance. More recently, serverless computing has gained popularity due to its built-in autoscaling abilities, reduced operational costs, and increased productivity. Building Serverless Microservices in Python begins by introducing you to serverless microservice structures. You will then learn how to create your first serverless data API and test your microservice. Moving on, you'll delve into data management and work with serverless patterns. Finally, the book introduces you to the importance of securing microservices. By the end of the book, you will have gained the skills you need to combine microservices with serverless computing, making their deployment much easier thanks to the cloud provider managing the servers and capacity planning.
Table of Contents (13 chapters)
Title Page
Dedication

Unit testing your Python Lambda code

In this section, we are going to look at why testing is important, as well as the sample data we can use for testing, unit testing, and mocking.

Why is testing important?

Think about the collaboration and teamwork taking place in large, distributed teams of developers in different countries, and imagine they want to collaborate on the same source code repository and check code changes at different times. It's very important for these teams to understand the code and be able to test it locally to see how it works, whether their changes will impact existing services, and whether the code is still working as expected.

Testing is important to ensure we have quality in the delivery or user experience...