db: Change ordering of test env setup and db connection init.

- DB init sets rhodecode.model.db.ENCRYPTION_KEY
- Test env setup resets rhodecode.model.db.ENCRYPTION_KEY to None
- Therefore DB init has to be done after test env setup.
This commit is contained in:
Johannes Bornhold 2016-06-07 10:26:08 +02:00
parent 422f825bb8
commit c58dd1646e

View file

@ -165,14 +165,15 @@ def make_pyramid_app(global_config, **settings):
config = Configurator(settings=settings)
add_pylons_compat_data(config.registry, global_config, settings_pylons)
# Initialize the database connection.
utils.initialize_database(settings_merged)
# If this is a test run we prepare the test environment like
# creating a test database, test search index and test repositories.
# This has to be done before the database connection is initialized.
if settings['is_test']:
utils.initialize_test_environment(settings_merged)
# Initialize the database connection.
utils.initialize_database(settings_merged)
includeme(config)
includeme_last(config)
pyramid_app = config.make_wsgi_app()