fix: log account merge notifications
This commit is contained in:
@@ -269,6 +269,10 @@ class AccountLinkingPanelTests(unittest.IsolatedAsyncioTestCase):
|
||||
"last_name": "",
|
||||
"language_code": "ru",
|
||||
}
|
||||
notification_service = SimpleNamespace(
|
||||
notify_account_telegram_linked=AsyncMock(),
|
||||
notify_account_merged=AsyncMock(),
|
||||
)
|
||||
|
||||
with (
|
||||
patch.object(account_routes, "_require_user_id", return_value=-100),
|
||||
@@ -299,7 +303,7 @@ class AccountLinkingPanelTests(unittest.IsolatedAsyncioTestCase):
|
||||
),
|
||||
patch(
|
||||
"bot.services.notification_service.NotificationService",
|
||||
return_value=SimpleNamespace(notify_account_telegram_linked=AsyncMock()),
|
||||
return_value=notification_service,
|
||||
),
|
||||
):
|
||||
response = await account_routes.account_telegram_link_route(request)
|
||||
@@ -325,4 +329,15 @@ class AccountLinkingPanelTests(unittest.IsolatedAsyncioTestCase):
|
||||
self.assertEqual(update_uuid, "panel-telegram")
|
||||
self.assertEqual(update_payload["email"], "linked@example.com")
|
||||
self.assertEqual(update_payload["telegramId"], 42)
|
||||
notification_service.notify_account_merged.assert_awaited_once_with(
|
||||
primary_user_id=42,
|
||||
removed_user_id=-100,
|
||||
email="linked@example.com",
|
||||
telegram_id=42,
|
||||
username="alice",
|
||||
first_name="Alice",
|
||||
final_end_date_text="",
|
||||
primary_panel_user_uuid="panel-telegram",
|
||||
removed_panel_user_uuid="panel-email",
|
||||
)
|
||||
self.assertIn("rw_webapp_session", response.cookies)
|
||||
|
||||
Reference in New Issue
Block a user