"""Tests for state manager."""

import pytest
from src.resilience.state_manager import get_state_manager, StateManager


class TestStateManager:
    """Tests for StateManager."""
    
    @pytest.fixture
    def state_manager(self):
        """Create state manager instance."""
        return get_state_manager()
    
    @pytest.mark.asyncio
    async def test_save_state(self, state_manager):
        """Test saving state."""
        result = await state_manager.save_state("test_key", {"data": "value"})
        assert result is True
    
    @pytest.mark.asyncio
    async def test_load_state(self, state_manager):
        """Test loading state."""
        # Save first
        await state_manager.save_state("test_key", {"data": "value"})
        
        # Load
        state = await state_manager.load_state("test_key")
        assert state is not None
        assert state.get("data") == "value"

