Made sure global settings are changed in test db creation
There was an assumption that changing connection.settings_dict changed also the settings.DATABASES values. This assumption is now gone.
This commit is contained in:
parent
1893467784
commit
905ea9619b
|
@ -281,6 +281,7 @@ class BaseDatabaseCreation(object):
|
||||||
self._create_test_db(verbosity, autoclobber)
|
self._create_test_db(verbosity, autoclobber)
|
||||||
|
|
||||||
self.connection.close()
|
self.connection.close()
|
||||||
|
settings.DATABASES[self.connection.alias]["NAME"] = test_database_name
|
||||||
self.connection.settings_dict["NAME"] = test_database_name
|
self.connection.settings_dict["NAME"] = test_database_name
|
||||||
|
|
||||||
# Report syncdb messages at one level lower than that requested.
|
# Report syncdb messages at one level lower than that requested.
|
||||||
|
|
|
@ -104,10 +104,12 @@ class DatabaseCreation(BaseDatabaseCreation):
|
||||||
print("Tests cancelled.")
|
print("Tests cancelled.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
self.connection.settings_dict['SAVED_USER'] = self.connection.settings_dict['USER']
|
from django.db import settings
|
||||||
self.connection.settings_dict['SAVED_PASSWORD'] = self.connection.settings_dict['PASSWORD']
|
real_settings = settings.DATABASES[self.connection.alias]
|
||||||
self.connection.settings_dict['TEST_USER'] = self.connection.settings_dict['USER'] = TEST_USER
|
real_settings['SAVED_USER'] = self.connection.settings_dict['SAVED_USER'] = self.connection.settings_dict['USER']
|
||||||
self.connection.settings_dict['PASSWORD'] = TEST_PASSWD
|
real_settings['SAVED_PASSWORD'] = self.connection.settings_dict['SAVED_PASSWORD'] = self.connection.settings_dict['PASSWORD']
|
||||||
|
real_settings['TEST_USER'] = real_settings['USER'] = self.connection.settings_dict['TEST_USER'] = self.connection.settings_dict['USER'] = TEST_USER
|
||||||
|
real_settings['PASSWORD'] = self.connection.settings_dict['PASSWORD'] = TEST_PASSWD
|
||||||
|
|
||||||
return self.connection.settings_dict['NAME']
|
return self.connection.settings_dict['NAME']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue