Hands-On Docker for Microservices with Python
上QQ阅读APP看书,第一时间看更新

test_thoughts.py

This file checks the defined API interfaces. Each API is tested to perform the actions correctly (create a new thought, return thoughts of a user, retrieve all thoughts, search through thoughts, and retrieve a thought by ID) as well as some error tests (unauthorized requests to create and retrieve thoughts of a user, or retrieve a non-existing thought).

Here, we use freezegun again to determine when the thoughts are created, instead of creating them with a timestamp dependent on the time when tests are run.