Преглед на файлове

reenable email notification for user creation

Guénaël Muller преди 5 години
родител
ревизия
558158226f

+ 18 - 0
backend/tests_configs.ini Целия файл

@@ -63,3 +63,21 @@ email.notification.smtp.server = 127.0.0.1
63 63
 email.notification.smtp.port = 1025
64 64
 email.notification.smtp.user = test_user
65 65
 email.notification.smtp.password = just_a_password
66
+
67
+[functional_test]
68
+sqlalchemy.url = sqlite:///tracim_test.sqlite
69
+depot_storage_name = test
70
+depot_storage_dir = /tmp/test/depot
71
+user.auth_token.validity = 604800
72
+preview_cache_dir = /tmp/test/preview_cache
73
+email.notification.activated = false
74
+preview.jpg.restricted_dims = True
75
+
76
+[functional_test_no_db]
77
+sqlalchemy.url = sqlite://
78
+depot_storage_name = test
79
+depot_storage_dir = /tmp/test/depot
80
+user.auth_token.validity = 604800
81
+preview_cache_dir = /tmp/test/preview_cache
82
+email.notification.activated = false
83
+preview.jpg.restricted_dims = True

+ 3 - 1
backend/tracim_backend/config.py Целия файл

@@ -160,9 +160,11 @@ class CFG(object):
160 160
 
161 161
         self.EMAIL_NOTIFICATION_FROM_EMAIL = settings.get(
162 162
             'email.notification.from.email',
163
+            'noreply+{user_id}@trac.im'
163 164
         )
164 165
         self.EMAIL_NOTIFICATION_FROM_DEFAULT_LABEL = settings.get(
165
-            'email.notification.from.default_label'
166
+            'email.notification.from.default_label',
167
+            'Tracim Notifications'
166 168
         )
167 169
         self.EMAIL_NOTIFICATION_REPLY_TO_EMAIL = settings.get(
168 170
             'email.notification.reply_to.email',

+ 8 - 11
backend/tracim_backend/tests/__init__.py Целия файл

@@ -68,20 +68,17 @@ def create_1000px_png_test_image():
68 68
 class FunctionalTest(unittest.TestCase):
69 69
 
70 70
     fixtures = [BaseFixture]
71
-    sqlalchemy_url = 'sqlite:///tracim_test.sqlite'
71
+    config_uri = 'tests_configs.ini'
72
+    config_section = 'functional_test'
72 73
 
73 74
     def setUp(self):
74 75
         logger._logger.setLevel('WARNING')
76
+
75 77
         DepotManager._clear()
76
-        self.settings = {
77
-            'sqlalchemy.url': self.sqlalchemy_url,
78
-            'user.auth_token.validity': '604800',
79
-            'depot_storage_dir': '/tmp/test/depot',
80
-            'depot_storage_name': 'test',
81
-            'preview_cache_dir': '/tmp/test/preview_cache',
82
-            'preview.jpg.restricted_dims': True,
83
-            'email.notification.activated': 'false',
84
-        }
78
+        self.settings = plaster.get_settings(
79
+            self.config_uri,
80
+            self.config_section
81
+        )
85 82
         hapic.reset_context()
86 83
         self.engine = get_engine(self.settings)
87 84
         DeclarativeBase.metadata.create_all(self.engine)
@@ -127,7 +124,7 @@ class FunctionalTestEmptyDB(FunctionalTest):
127 124
 
128 125
 
129 126
 class FunctionalTestNoDB(FunctionalTest):
130
-    sqlalchemy_url = 'sqlite://'
127
+    config_section = 'functional_test_no_db'
131 128
 
132 129
     def init_database(self, settings):
133 130
         self.engine = get_engine(settings)

+ 6 - 1
backend/tracim_backend/views/core_api/workspace_controller.py Целия файл

@@ -214,11 +214,16 @@ class WorkspaceController(Controller):
214 214
                 # notification for creation
215 215
                 user = uapi.create_user(
216 216
                     hapic_data.body.user_email_or_public_name,
217
-                    do_notify=False
217
+                    do_notify=True
218 218
                 )  # nopep8
219 219
                 newly_created = True
220
+                if app_config.EMAIL_NOTIFICATION_ACTIVATED and \
221
+                        app_config.EMAIL_PROCESSING_MODE == 'SYNC':
222
+                    email_sent = True
223
+
220 224
             except EmailValidationFailed:
221 225
                 raise UserCreationFailed('no valid mail given')
226
+
222 227
         role = rapi.create_one(
223 228
             user=user,
224 229
             workspace=request.current_workspace,