From 24d34558544ec737aafdf7fac9cbde6f65709dcc Mon Sep 17 00:00:00 2001 From: Martin Bornhold Date: Mon, 8 Aug 2016 15:02:12 +0200 Subject: [PATCH] tests: Add a fixture to get the settings dict. --- rhodecode/tests/plugin.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py index aaf53f1c..e7bcbf81 100644 --- a/rhodecode/tests/plugin.py +++ b/rhodecode/tests/plugin.py @@ -214,6 +214,22 @@ def app(request, pylonsapp, http_environ): return app +@pytest.fixture() +def app_settings(pylonsapp, pylons_config): + """ + Settings dictionary used to create the app. + + Parses the ini file and passes the result through the sanitize and apply + defaults mechanism in `rhodecode.config.middleware`. + """ + from paste.deploy.loadwsgi import loadcontext, APP + from rhodecode.config.middleware import ( + sanitize_settings_and_apply_defaults) + context = loadcontext(APP, 'config:' + pylons_config) + settings = sanitize_settings_and_apply_defaults(context.config()) + return settings + + LoginData = collections.namedtuple('LoginData', ('csrf_token', 'user'))