# HG changeset patch # User Martin Bornhold # Date 2016-08-08 13:02:12 # Node ID 3bdca2728117ad8a49f8ccc9ed30b041f828b70e # Parent e1a806edec2c003fd6cd22f2c18b7729f2e463c7 tests: Add a fixture to get the settings dict. diff --git a/rhodecode/tests/plugin.py b/rhodecode/tests/plugin.py --- 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'))