Django unittesting different databases for api and for test
I'm assuming you're doing REST service, preferably with Django Rest Framework (DRF). If not, look it up.
The correct approach to testing your own API is:

Create a class which inherits APITestCase.
Create a test function in the class, for example: test_my_thing(self):
Use the django 'reverse' function to generate the URL to your tested API.
Use self.client.get, self.client.post, self.client.delete and store the response in a variable.
response.json() gives you the response body in a json format
Assert the response.
By default django creates a test database when running tests which raises some inconvenience for me:
The API that i am writing test for uses a database. When i run the test, a new database is created, some dummy data is being inserted into the test database and a http post request is being sent to the API under test. What happens is that my API under test does not see inserted data.
With the problem explained, what are the right solutions / best practices for testing APIs with databases ?