Local changes: Updated model training, removed debug instrumentation, and configuration improvements
This commit is contained in:
71
tests/integration/test_pricing_providers.py
Normal file
71
tests/integration/test_pricing_providers.py
Normal file
@@ -0,0 +1,71 @@
|
||||
"""Integration tests for pricing provider system."""
|
||||
|
||||
import pytest
|
||||
from datetime import datetime
|
||||
|
||||
from src.data.pricing_service import get_pricing_service
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
class TestPricingProviderIntegration:
|
||||
"""Integration tests for pricing providers."""
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup(self):
|
||||
"""Set up test fixtures."""
|
||||
# Reset global service instance
|
||||
import src.data.pricing_service
|
||||
src.data.pricing_service._pricing_service = None
|
||||
|
||||
def test_service_initialization(self):
|
||||
"""Test that pricing service initializes correctly."""
|
||||
service = get_pricing_service()
|
||||
assert service is not None
|
||||
assert service.cache is not None
|
||||
assert service.health_monitor is not None
|
||||
|
||||
@pytest.mark.skip(reason="Requires network access - run manually")
|
||||
def test_get_ticker_integration(self):
|
||||
"""Test getting ticker data from real providers."""
|
||||
service = get_pricing_service()
|
||||
|
||||
# This will try to connect to real providers
|
||||
ticker = service.get_ticker("BTC/USD", use_cache=False)
|
||||
|
||||
# Should get some data if providers are available
|
||||
if ticker:
|
||||
assert 'symbol' in ticker
|
||||
assert 'last' in ticker
|
||||
assert ticker['last'] > 0
|
||||
|
||||
@pytest.mark.skip(reason="Requires network access - run manually")
|
||||
def test_provider_failover(self):
|
||||
"""Test provider failover mechanism."""
|
||||
service = get_pricing_service()
|
||||
|
||||
# Get active provider
|
||||
active = service.get_active_provider()
|
||||
assert active is not None or len(service._providers) == 0
|
||||
|
||||
def test_cache_integration(self):
|
||||
"""Test cache integration with service."""
|
||||
service = get_pricing_service()
|
||||
|
||||
# Set a value
|
||||
service.cache.set("test:key", "test_value", ttl=60)
|
||||
|
||||
# Get it back
|
||||
value = service.cache.get("test:key")
|
||||
assert value == "test_value"
|
||||
|
||||
def test_health_monitoring(self):
|
||||
"""Test health monitoring integration."""
|
||||
service = get_pricing_service()
|
||||
|
||||
# Record some metrics
|
||||
service.health_monitor.record_success("test_provider", 0.5)
|
||||
service.health_monitor.record_failure("test_provider")
|
||||
|
||||
# Check health
|
||||
is_healthy = service.health_monitor.is_healthy("test_provider")
|
||||
assert isinstance(is_healthy, bool)
|
||||
Reference in New Issue
Block a user