From 7fefcc4ffbbfe163ff87f7234c35def05d108d1a Mon Sep 17 00:00:00 2001 From: Johannes Bornhold Date: Tue, 7 Jun 2016 11:13:50 +0200 Subject: [PATCH] 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. --- rhodecode/config/environment.py | 1 - rhodecode/config/middleware.py | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/rhodecode/config/environment.py b/rhodecode/config/environment.py index 1d853365..b7f35938 100644 --- a/rhodecode/config/environment.py +++ b/rhodecode/config/environment.py @@ -62,7 +62,6 @@ def load_environment(global_conf, app_conf, initial=False, """ config = PylonsConfig() - rhodecode.is_test = str2bool(app_conf.get('is_test', 'False')) # Pylons paths root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) diff --git a/rhodecode/config/middleware.py b/rhodecode/config/middleware.py index 9a92eafd..5ff037da 100644 --- a/rhodecode/config/middleware.py +++ b/rhodecode/config/middleware.py @@ -168,7 +168,9 @@ def make_pyramid_app(global_config, **settings): # 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']: if settings['is_test']: + rhodecode.is_test = True utils.initialize_test_environment(settings_merged) # 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, 'static_files', 'true') + _bool_setting(settings, 'is_test', 'false') return settings