def test_search_events_reverse_order(self, mock_get, event_store):
        """Test event retrieval in reverse order."""
        # Setup mock response
        mock_events = [
            create_mock_event(3, 'World', 'agent'),
            create_mock_event(2, 'Hello', 'user'),
        ]
        mock_get.return_value = create_mock_response(mock_events)

        # Call the method with reverse=True
        events = list(event_store.search_events(reverse=True))

        # Verify the results
        assert len(events) == 2
        assert events[0].id == 3
        assert events[1].id == 2

        # Verify the API call includes reverse=True
        mock_get.assert_called_once_with(
            'http://test-api.example.com/events?start_id=0&reverse=True',
            headers={'X-Session-API-Key': 'test-api-key'},
        )
Test event retrieval in reverse order.
tests/unit/test_nested_event_store.py