Removed useless test that worked but threw a bunch of warnings
This commit is contained in:
@@ -135,7 +135,9 @@ class TestEmailService:
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_send_alert(self, email_service):
|
async def test_send_alert(self, email_service):
|
||||||
"""Test send_alert convenience method."""
|
"""Test send_alert convenience method."""
|
||||||
with patch.object(email_service, "send_email", new_callable=AsyncMock) as mock_send:
|
with patch.object(
|
||||||
|
email_service, "send_email", new_callable=AsyncMock
|
||||||
|
) as mock_send:
|
||||||
mock_send.return_value = True
|
mock_send.return_value = True
|
||||||
|
|
||||||
result = await email_service.send_alert(
|
result = await email_service.send_alert(
|
||||||
@@ -152,7 +154,9 @@ class TestEmailService:
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_send_daily_report(self, email_service):
|
async def test_send_daily_report(self, email_service):
|
||||||
"""Test daily report email generation and sending."""
|
"""Test daily report email generation and sending."""
|
||||||
with patch.object(email_service, "send_email", new_callable=AsyncMock) as mock_send:
|
with patch.object(
|
||||||
|
email_service, "send_email", new_callable=AsyncMock
|
||||||
|
) as mock_send:
|
||||||
mock_send.return_value = True
|
mock_send.return_value = True
|
||||||
|
|
||||||
stats = {
|
stats = {
|
||||||
@@ -280,25 +284,6 @@ class TestEmailAlertHandler:
|
|||||||
assert alert_handler.cooldown_minutes == 5
|
assert alert_handler.cooldown_minutes == 5
|
||||||
assert alert_handler.recipients == ["alert@example.com"]
|
assert alert_handler.recipients == ["alert@example.com"]
|
||||||
|
|
||||||
def test_handler_emit_below_threshold(self, alert_handler):
|
|
||||||
"""Test emitting errors below threshold."""
|
|
||||||
log_record = logging.LogRecord(
|
|
||||||
name="test",
|
|
||||||
level=logging.ERROR,
|
|
||||||
pathname="/test.py",
|
|
||||||
lineno=1,
|
|
||||||
msg="Error 1",
|
|
||||||
args=(),
|
|
||||||
exc_info=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Emit 2 errors (below threshold of 3)
|
|
||||||
alert_handler.emit(log_record)
|
|
||||||
alert_handler.emit(log_record)
|
|
||||||
|
|
||||||
# Should buffer, not send immediately
|
|
||||||
assert len(alert_handler.error_buffer) == 2
|
|
||||||
|
|
||||||
def test_handler_ignores_non_error_levels(self, alert_handler):
|
def test_handler_ignores_non_error_levels(self, alert_handler):
|
||||||
"""Test that handler ignores INFO and WARNING levels."""
|
"""Test that handler ignores INFO and WARNING levels."""
|
||||||
log_record = logging.LogRecord(
|
log_record = logging.LogRecord(
|
||||||
|
|||||||
Reference in New Issue
Block a user