I have added a new database in my django project. Now I have run into issues with my test cases. I am keep getting this error message for every single of my test cases:
Database queries to 'new-database' are not allowed in this test
I have searched for this issue and the common solution comes down to adding databases = '__all__'
or databases = {'default', 'new_database'}
to the TestCase class
But the problem is that now we have a lot of these test cases in my django application and a lot of corresponding TestCase based classes. So it does not fill right (specifically from the scale point of view) to add this databases = '__all__'
declaration or whatever to every single class.
Do we have any other and more proper solution for this issue?
(After all why django needs to make transaction to new_database
in all other test cases every single time that does not seem needed at all?)