Skip to main content
Glama
test_manager.py1.3 kB
"""RED: Tests for session manager.""" import pytest from ids_mcp_server.session.manager import ( get_or_create_session, create_session_from_string ) from ifctester import ids @pytest.mark.asyncio async def test_get_or_create_session_new(mock_context): """Test creating new session via Context.""" ids_obj = await get_or_create_session(mock_context) assert ids_obj is not None assert isinstance(ids_obj, ids.Ids) @pytest.mark.asyncio async def test_get_or_create_session_existing(mock_context): """Test retrieving existing session.""" # First call creates ids_obj1 = await get_or_create_session(mock_context) ids_obj1.info["title"] = "Test IDS" # Second call retrieves same object ids_obj2 = await get_or_create_session(mock_context) assert ids_obj2.info["title"] == "Test IDS" assert ids_obj1 is ids_obj2 # Same object reference @pytest.mark.asyncio async def test_create_session_from_string(mock_context, sample_ids_xml): """Test loading IDS from XML string.""" ids_obj = await create_session_from_string(mock_context, sample_ids_xml) assert ids_obj.info["title"] == "Test IDS" # Verify it's stored in session ids_obj2 = await get_or_create_session(mock_context) assert ids_obj2.info["title"] == "Test IDS"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vinnividivicci/ifc-ids-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server