|
8 | 8 | from website import settings |
9 | 9 | from website.util.metrics import OsfSourceTags |
10 | 10 | from framework.auth import Auth |
| 11 | +from framework.auth.views import send_confirm_email |
11 | 12 |
|
12 | 13 | from osf_tests.factories import ( |
13 | 14 | UserFactory, |
|
18 | 19 | ) |
19 | 20 | from importlib import import_module |
20 | 21 | from django.conf import settings as django_conf_settings |
21 | | -from osf.models import UserSessionMap |
22 | | -from tests.utils import run_celery_tasks |
| 22 | +from osf.models import UserSessionMap, NotificationType |
| 23 | +from tests.utils import run_celery_tasks, capture_notifications |
23 | 24 | from waffle.testutils import override_flag |
24 | 25 | from osf.features import ENABLE_GV |
25 | 26 |
|
@@ -288,3 +289,15 @@ def test_merge_doesnt_send_signal(self): |
288 | 289 | with override_flag(ENABLE_GV, active=True): |
289 | 290 | self.user.merge_user(other_user) |
290 | 291 | assert other_user.merged_by._id == self.user._id |
| 292 | + |
| 293 | + def test_send_confirm_email_emits_merge_notification(self): |
| 294 | + merger = UserFactory() |
| 295 | + merge_target = UserFactory() |
| 296 | + target_email = merge_target.username |
| 297 | + |
| 298 | + merger.add_unconfirmed_email(target_email) |
| 299 | + merger.save() |
| 300 | + with capture_notifications() as notifications: |
| 301 | + send_confirm_email(merger, target_email) |
| 302 | + assert len(notifications['emits']) == 1 |
| 303 | + assert notifications['emits'][0]['type'] == NotificationType.Type.USER_CONFIRM_MERGE |
0 commit comments