tests: Add a fixture to get the settings dict.

This commit is contained in:
Martin Bornhold 2016-08-08 15:02:12 +02:00
parent 753b920fa8
commit 24d3455854

View file

@ -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'))