def test_search_events_pagination(self, mock_get, event_store):
        """Test event retrieval with pagination (has_more=True)."""
        # Setup first page response
        first_page_events = [
            create_mock_event(1, 'Hello', 'user'),
            create_mock_event(2, 'World', 'agent'),
        ]
        first_response = create_mock_response(first_page_events, has_more=True)

        # Setup second page response
        second_page_events = [
            create_mock_event(3, 'More', 'user'),
            create_mock_event(4, 'Data', 'agent'),
        ]
        second_response = create_mock_response(second_page_events, has_more=False)

        # Configure mock to return different responses on consecutive calls
        mock_get.side_effect = [first_response, second_response]

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

        # Verify the results (should include all events from both pages)
        assert len(events) == 4
        assert events[0].id == 1
        assert events[1].id == 2
        assert events[2].id == 3
        assert events[3].id == 4

        # Verify the API calls
        assert mock_get.call_count == 2
        # First call with start_id=0
        mock_get.assert_any_call(
            'http://test-api.example.com/events?start_id=0&reverse=False',
            headers={'X-Session-API-Key': 'test-api-key'},
        )
        # Second call with start_id=3 (after processing events with IDs 1 and 2)
        mock_get.assert_any_call(
            'http://test-api.example.com/events?start_id=3&reverse=False',
            headers={'X-Session-API-Key': 'test-api-key'},
        )
Test event retrieval with pagination (has_more=True).
tests/unit/test_nested_event_store.py