Skip to main content
Glama
bitgeese

Sequential Questioning MCP Server

by bitgeese
test_user_session.py2.67 kB
import pytest from sqlalchemy.future import select from app.models.user_session import UserSession @pytest.mark.asyncio async def test_user_session_create(db_session): """Test creating a user session.""" # Create a new user session user_session = UserSession( user_identifier="test_user", context="Test context", is_active=True ) db_session.add(user_session) await db_session.commit() # Retrieve the user session from the database result = await db_session.execute(select(UserSession).where(UserSession.user_identifier == "test_user")) retrieved_session = result.scalars().first() # Assert that the session was created and has the correct attributes assert retrieved_session is not None assert retrieved_session.user_identifier == "test_user" assert retrieved_session.context == "Test context" assert retrieved_session.is_active is True assert retrieved_session.created_at is not None assert retrieved_session.updated_at is not None @pytest.mark.asyncio async def test_user_session_update(db_session): """Test updating a user session.""" # Create a new user session user_session = UserSession( user_identifier="update_user", context="Original context", is_active=True ) db_session.add(user_session) await db_session.commit() # Update the user session user_session.context = "Updated context" user_session.is_active = False await db_session.commit() # Retrieve the updated user session result = await db_session.execute(select(UserSession).where(UserSession.user_identifier == "update_user")) updated_session = result.scalars().first() # Assert that the session was updated assert updated_session is not None assert updated_session.context == "Updated context" assert updated_session.is_active is False @pytest.mark.asyncio async def test_user_session_delete(db_session): """Test deleting a user session.""" # Create a new user session user_session = UserSession( user_identifier="delete_user", context="Delete context", is_active=True ) db_session.add(user_session) await db_session.commit() # Delete the user session await db_session.delete(user_session) await db_session.commit() # Try to retrieve the deleted user session result = await db_session.execute(select(UserSession).where(UserSession.user_identifier == "delete_user")) deleted_session = result.scalars().first() # Assert that the session was deleted assert deleted_session is None

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/bitgeese/sequential-questioning'

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