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