def test_get_settings_env_overrides_base(settings_from_environment): base_settings = {'foo': 'base'} env_settings = {'foo': 'env'} settings_from_environment.return_value = env_settings result = app.get_settings({}, **base_settings) assert result['foo'] == 'env'
def test_get_settings_global_overrides_all(settings_from_environment): base_settings = {'bar': 'base'} global_settings = {'bar': 'global'} env_settings = {'bar': 'env'} settings_from_environment.return_value = env_settings result = app.get_settings(global_settings, **base_settings) assert result['bar'] == 'global'
def create_app(global_config, **settings): settings = get_settings(global_config, **settings) config = Configurator(settings=settings) config.add_request_method(features.flag_enabled, name='feature') config.include('h.auth') config.include('h.sentry') # We have to include models and db to set up sqlalchemy metadata. config.include('h.models') config.include('h.db') config.include('h.api.db') # We have to include search to set up the `request.es` property. config.include('h.api.search') config.include('h.streamer') return config.make_wsgi_app()