From a70cd14bee6454f24ca59adca286ece9e73bdc0f Mon Sep 17 00:00:00 2001 From: Cam Proudlock Date: Wed, 22 Jul 2026 10:57:19 -0400 Subject: [PATCH] alerts: Teams webhook fan-out + contract 0.14.0 --- tests/test_core/test_webhook_alert.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_core/test_webhook_alert.py b/tests/test_core/test_webhook_alert.py index cc515319..e82684eb 100644 --- a/tests/test_core/test_webhook_alert.py +++ b/tests/test_core/test_webhook_alert.py @@ -25,18 +25,18 @@ def test_noop_when_unset(app): def test_posts_when_configured(app): with app.app_context(): with patch('shopdb.utils.mailer.get_webhook_config', return_value=CFG), \ - patch('shopdb.utils.mailer.requests') as req: - req.post.return_value.status_code = 200 + patch('shopdb.utils.mailer.requests') as mock_requests: + mock_requests.post.return_value.status_code = 200 ok, err = send_webhook('Low stock', 'x down') assert ok is True and err is None - assert req.post.call_args[0][0] == CFG['url'] - assert req.post.call_args[1]['json']['@type'] == 'MessageCard' + assert mock_requests.post.call_args[0][0] == CFG['url'] + assert mock_requests.post.call_args[1]['json']['@type'] == 'MessageCard' def test_send_alert_fans_out_to_webhook(app): with app.app_context(): with patch('shopdb.utils.mailer.get_webhook_config', return_value=CFG), \ - patch('shopdb.utils.mailer.requests') as req: - req.post.return_value.status_code = 200 + patch('shopdb.utils.mailer.requests') as mock_requests: + mock_requests.post.return_value.status_code = 200 send_alert('Subject', '

Body

') - assert req.post.called # webhook fired even with no email recipients + assert mock_requests.post.called # webhook fired even with no email recipients