Files
crypto_trader/tests/unit/alerts/test_engine.py

34 lines
929 B
Python

"""Tests for alert engine."""
import pytest
from src.alerts.engine import get_alert_engine, AlertEngine
class TestAlertEngine:
"""Tests for AlertEngine."""
@pytest.fixture
def alert_engine(self):
"""Create alert engine instance."""
return get_alert_engine()
def test_alert_engine_initialization(self, alert_engine):
"""Test alert engine initialization."""
assert alert_engine is not None
@pytest.mark.asyncio
async def test_process_alert(self, alert_engine):
"""Test processing alert."""
# Create test alert
alert = {
'name': 'test_alert',
'type': 'price',
'condition': 'BTC/USD > 50000',
'is_active': True
}
# Process alert (simplified)
result = await alert_engine.process_alert(alert, {'BTC/USD': 51000.0})
assert isinstance(result, bool)