Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: remove patch logger in test, use caplog instead (Closes #37468) (#39159)
sahasweety83f40b85f4c8
diff --git a/api/tests/unit_tests/services/test_webhook_service.py b/api/tests/unit_tests/services/test_webhook_service.pyindex 4babcd049c8..2e6bc70bca0 100644--- a/api/tests/unit_tests/services/test_webhook_service.py+++ b/api/tests/unit_tests/services/test_webhook_service.py@@ -13,7 +13,9 @@ from services.trigger.webhook_service import WebhookServiceclass TestWebhookServiceUnit:"""Unit tests for WebhookService focusing on business logic without database dependencies."""- def test_trigger_workflow_execution_propagates_quota_error_without_error_log(self):+ def test_trigger_workflow_execution_propagates_quota_error_without_error_log(+ self, caplog: pytest.LogCaptureFixture+ ):webhook_trigger = MagicMock(webhook_id="webhook-123",tenant_id="tenant-123",@@ -24,6 +26,7 @@ class TestWebhookServiceUnit:quota_charge = MagicMock()quota_error = QuotaExceededError(feature="workflow", tenant_id="tenant-123", required=1)+ caplog.set_level(logging.INFO)with (patch("services.trigger.webhook_service.EndUserService.get_or_create_end_user_by_type",@@ -36,8 +39,6 @@ class TestWebhookServiceUnit:"services.trigger.webhook_service.AsyncWorkflowService.trigger_workflow_async",side_effect=quota_error,),- patch("services.trigger.webhook_service.logger.info") as mock_log_info,- patch("services.trigger.webhook_service.logger.exception") as mock_log_exception,):with pytest.raises(QuotaExceededError) as exc_info:WebhookService.trigger_workflow_execution(@@ -48,13 +49,13 @@ class TestWebhookServiceUnit:assert exc_info.value is quota_errorquota_charge.refund.assert_called_once_with()- mock_log_info.assert_called_once_with(- "Tenant %s quota exceeded for feature %s, skipping webhook trigger %s",- webhook_trigger.tenant_id,- quota_error.feature,- webhook_trigger.webhook_id,++ # Verify logs using caplog instead of mock_log+ assert len(caplog.records) == 1+ assert caplog.records[0].levelno == logging.INFO+ assert caplog.records[0].message == (+ "Tenant tenant-123 quota exceeded for feature workflow, skipping webhook trigger webhook-123")- mock_log_exception.assert_not_called()def test_extract_webhook_data_json(self):"""Test webhook data extraction from JSON request."""