I am trying to configure some tests in my Django application. I use a database mirror for some readings made throughout the application. When I try to test these parts by creating data mockups in the database and then try to read them, it seems that the data is not in the mirror database, despite the fact that they are configured as TEST_MIRROR .
The database configuration for testing is as follows:
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'maindb', 'HOST': 'localhost' }, 'mirror1': { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'maindb', 'HOST': 'localhost', 'TEST_MIRROR': 'default' } }
And then in my test I do something like this (Foo - model)
Foo.objects.create(name='bar') self.assertTrue(Foo.objects.filter(name='bar').exists())
This is confusing for me, since I thought that the point of TEST_MIRROR was to make calls to the mirror right to the default value?
source share