|
8 | 8 | from opengever.activity.roles import TASK_RESPONSIBLE_ROLE |
9 | 9 | from opengever.base.interfaces import IOGMailSettings |
10 | 10 | from opengever.globalindex.model.task import Task |
| 11 | +from opengever.ogds.models.user_settings import UserSettings |
11 | 12 | from opengever.task.activities import TaskAddedActivity |
12 | 13 | from opengever.testing import IntegrationTestCase |
13 | 14 | from plone import api |
@@ -179,6 +180,34 @@ def test_from_address_with_send_with_actor_from_address_enabled(self, browser): |
179 | 180 | mail = email.message_from_string(Mailing(self.portal).pop()) |
180 | 181 | self. assertEquals( 'Ziegler Robert <[email protected]>', get_header( mail, 'From')) |
181 | 182 |
|
| 183 | + @browsing |
| 184 | + def test_from_address_fallback_if_notify_own_action_and_send_with_actor_from_address_enabled(self, browser): |
| 185 | + UserSettings.save_setting_for_user( |
| 186 | + self.regular_user.getId(), 'notify_own_actions', True) |
| 187 | + |
| 188 | + api.portal.set_registry_record( |
| 189 | + 'send_with_actor_from_address', True, IOGMailSettings) |
| 190 | + |
| 191 | + self.login(self.dossier_responsible, browser) |
| 192 | + self.create_task_via_browser(browser) |
| 193 | + process_mail_queue() |
| 194 | + |
| 195 | + # It uses the email address of the currently logged in user to send |
| 196 | + # an email, if the recipients email is different. |
| 197 | + mail = email.message_from_string(Mailing(self.portal).pop()) |
| 198 | + self. assertEquals( 'Ziegler Robert <[email protected]>', get_header( mail, 'From')) |
| 199 | + self. assertEquals( '[email protected]', get_header( mail, 'To')) |
| 200 | + |
| 201 | + self.login(self.regular_user, browser) |
| 202 | + self.create_task_via_browser(browser) |
| 203 | + process_mail_queue() |
| 204 | + |
| 205 | + # But it uses the portal email address, if the senders email is the same |
| 206 | + # as the recipient email address. This avoids spam filters blocking the email. |
| 207 | + mail = email.message_from_string(Mailing(self.portal).pop()) |
| 208 | + self.assertEquals('B\xc3\xa4rfuss K\xc3\xa4thi <test@localhost>', get_header(mail, 'From')) |
| 209 | + self. assertEquals( '[email protected]', get_header( mail, 'To')) |
| 210 | + |
182 | 211 | @browsing |
183 | 212 | def test_task_title_is_linked_to_resolve_notification_view(self, browser): |
184 | 213 | self.login(self.dossier_responsible, browser) |
|
0 commit comments