Writing tests in Postman
In this section, we will be using Postman to test our API endpoints. This will test our JSON processing and database access. In order to do this, we will follow these steps:
- We are going to have to create a test user for our Postman tests. We can do this with the JSON body shown as follows:
{ Â Â Â Â "name": "test", Â Â Â Â "email": "[email protected]", Â Â Â Â "password": "test" }
- We need to add a POST request to the URL
http://127.0.0.1:8000/api/v1/user/create
. Once we have done this, we can use our login endpoint for our Postman tests. Now that we have created our test user, we have to get the token from the response header of the POST request to the URLhttp://127.0.0.1:8000/api/v1/auth/login
with the JSON request body:{ Â Â Â Â "username": "test", Â Â Â Â "password": "test...