Show More
@@ -28,7 +28,7 b' import appenlight.lib.encryption as encryption' | |||
|
28 | 28 | from pyramid.config import PHASE3_CONFIG |
|
29 | 29 | from pyramid.authentication import AuthTktAuthenticationPolicy |
|
30 | 30 | from pyramid.authorization import ACLAuthorizationPolicy |
|
31 |
from pyramid_mailer. |
|
|
31 | from pyramid_mailer.interfaces import IMailer | |
|
32 | 32 | from pyramid.renderers import JSON |
|
33 | 33 | from pyramid_redis_sessions import session_factory_from_settings |
|
34 | 34 | from pyramid.settings import asbool, aslist |
@@ -143,6 +143,7 b' def main(global_config, **settings):' | |||
|
143 | 143 | config.include('pyramid_redis_sessions') |
|
144 | 144 | config.include('pyramid_tm') |
|
145 | 145 | config.include('pyramid_jinja2') |
|
146 | config.include('pyramid_mailer') | |
|
146 | 147 | config.include('appenlight_client.ext.pyramid_tween') |
|
147 | 148 | config.include('ziggurat_foundations.ext.pyramid.sign_in') |
|
148 | 149 | es_server_list = aslist(settings['elasticsearch.nodes']) |
@@ -154,8 +155,8 b' def main(global_config, **settings):' | |||
|
154 | 155 | |
|
155 | 156 | config.registry.redis_lockmgr = Redlock([settings['redis.redlock.url'], ], |
|
156 | 157 | retry_count=0, retry_delay=0) |
|
157 | # mailer | |
|
158 | config.registry.mailer = Mailer.from_settings(settings) | |
|
158 | # mailer bw compat | |
|
159 | config.registry.mailer = config.registry.getUtility(IMailer) | |
|
159 | 160 | |
|
160 | 161 | # Configure sessions |
|
161 | 162 | session_factory = session_factory_from_settings(settings) |
@@ -27,11 +27,12 b' from zope.sqlalchemy import mark_changed' | |||
|
27 | 27 | from pyramid.paster import get_appsettings |
|
28 | 28 | from pyramid import testing |
|
29 | 29 | |
|
30 | from appenlight.models import Base, DBSession | |
|
31 | ||
|
32 | 30 | |
|
33 | 31 | @pytest.fixture |
|
34 | def base_app(request): | |
|
32 | def base_app(request, mocker): | |
|
33 | # disable email sending | |
|
34 | mocker.patch('pyramid_mailer.mailer_factory_from_settings', mocker.Mock()) | |
|
35 | ||
|
35 | 36 | from appenlight import main |
|
36 | 37 | import transaction |
|
37 | 38 | current_dir = os.path.dirname(os.path.abspath(__file__)) |
@@ -91,6 +92,8 b' def default_data(base_app):' | |||
|
91 | 92 | |
|
92 | 93 | @pytest.fixture |
|
93 | 94 | def clean_tables(request): |
|
95 | from appenlight.models import Base, DBSession | |
|
96 | ||
|
94 | 97 | def fin(): |
|
95 | 98 | tables = Base.metadata.tables.keys() |
|
96 | 99 | transaction.begin() |
@@ -106,6 +109,7 b' def clean_tables(request):' | |||
|
106 | 109 | |
|
107 | 110 | @pytest.fixture |
|
108 | 111 | def default_user(): |
|
112 | from appenlight.models import DBSession | |
|
109 | 113 | from appenlight.models.user import User |
|
110 | 114 | from appenlight.models.auth_token import AuthToken |
|
111 | 115 | transaction.begin() |
@@ -124,6 +128,7 b' def default_user():' | |||
|
124 | 128 | |
|
125 | 129 | @pytest.fixture |
|
126 | 130 | def default_application(default_user): |
|
131 | from appenlight.models import DBSession | |
|
127 | 132 | from appenlight.models.application import Application |
|
128 | 133 | |
|
129 | 134 | transaction.begin() |
General Comments 0
You need to be logged in to leave comments.
Login now