db: Set rhodecode.is_test in make_pyramid_app instead of make_app

Based on this setting the crypto backend is selected: brypt or md5.
During tests md5 is used to sppedup test execution. We have to move this
setting up to the pyramid layer otherwise the test DB init will use bcrypt
and the tests use md5. This will result in test users not able to login.
This commit is contained in:
Johannes Bornhold 2016-06-07 11:13:50 +02:00
parent c58dd1646e
commit 7fefcc4ffb
2 changed files with 3 additions and 1 deletions

View file

@ -62,7 +62,6 @@ def load_environment(global_conf, app_conf, initial=False,
""" """
config = PylonsConfig() config = PylonsConfig()
rhodecode.is_test = str2bool(app_conf.get('is_test', 'False'))
# Pylons paths # Pylons paths
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

View file

@ -168,7 +168,9 @@ def make_pyramid_app(global_config, **settings):
# If this is a test run we prepare the test environment like # If this is a test run we prepare the test environment like
# creating a test database, test search index and test repositories. # creating a test database, test search index and test repositories.
# This has to be done before the database connection is initialized. # This has to be done before the database connection is initialized.
# if settings['is_test']:
if settings['is_test']: if settings['is_test']:
rhodecode.is_test = True
utils.initialize_test_environment(settings_merged) utils.initialize_test_environment(settings_merged)
# Initialize the database connection. # Initialize the database connection.
@ -316,6 +318,7 @@ def sanitize_settings_and_apply_defaults(settings):
_bool_setting(settings, 'vcs.server.enable', 'true') _bool_setting(settings, 'vcs.server.enable', 'true')
_bool_setting(settings, 'static_files', 'true') _bool_setting(settings, 'static_files', 'true')
_bool_setting(settings, 'is_test', 'false')
return settings return settings