mm
Amos Omondi

Posts by: Amos Omondi

Writing, Testing, and Deploying a Django API to Heroku with Semaphore

Introduction In this tutorial, you will learn how to write and deploy a Django API to Heroku using Semaphore. You’ll also learn how to run Django tests on Semaphore, and how to use Heroku pipelines and Heroku review apps with Semaphore. If you’d like to use Semaphore to deploy to other platforms, you can find guides to setting up automatic and manual deployment in Semaphore documentation. The API we will…

Generating Fake Data for Python Unit Tests with Faker

Introduction When writing unit tests, you might come across a situation where you need to generate test data or use some dummy data in your tests. If you already have some data somewhere in a database, one solution you could employ is to generate a dump of that data and use that in your tests (i.e. fixtures). However, you could also use a package like faker to generate fake data…

Getting Started with Mocking in Python

Introduction Mocking is simply the act of replacing the part of the application you are testing with a dummy version of that part called a mock. Instead of calling the actual implementation, you would call the mock, and then make assertions about what you expect to happen. What are the benefits of mocking? Increased speed — Tests that run quickly are extremely beneficial. E.g. if you have a very resource…