Skip to main content
Glama
test_meeting_endpoints.py5.92 kB
#!/usr/bin/env python3 """ Test script for new meeting scheduling endpoints. Tests: findMeetingTimes, getSchedule, createOnlineMeeting """ import requests import json from datetime import datetime, timedelta BASE_URL = "http://localhost:8001" def test_find_meeting_times(): """Test finding available meeting times.""" print("\n=== Test 1: Find Meeting Times ===") # Calculate tomorrow's time window (9 AM - 6 PM) tomorrow = datetime.now() + timedelta(days=1) start_time = tomorrow.replace(hour=9, minute=0, second=0, microsecond=0) end_time = tomorrow.replace(hour=18, minute=0, second=0, microsecond=0) payload = { "attendees": [ "giovanni.albero@infocert.it", "daniele.rosa@infocert.it" ], "duration": 30, "start_time": start_time.isoformat(), "end_time": end_time.isoformat(), "max_candidates": 3 } response = requests.post(f"{BASE_URL}/calendar/findMeetingTimes", json=payload) print(f"Status Code: {response.status_code}") if response.status_code == 200: data = response.json() print(f"Success: {data.get('success')}") print(f"Suggestions Found: {len(data.get('suggestions', []))}") for idx, suggestion in enumerate(data.get('suggestions', [])[:3], 1): time_slot = suggestion.get('meetingTimeSlot', {}) start = time_slot.get('start', {}).get('dateTime', 'N/A') end = time_slot.get('end', {}).get('dateTime', 'N/A') confidence = suggestion.get('confidence', 'N/A') print(f"\n Suggestion {idx}:") print(f" Start: {start}") print(f" End: {end}") print(f" Confidence: {confidence}") return True else: print(f"Error: {response.text}") return False def test_get_schedule(): """Test getting schedule for multiple users.""" print("\n\n=== Test 2: Get Schedule ===") # Check schedule for tomorrow morning tomorrow = datetime.now() + timedelta(days=1) start_time = tomorrow.replace(hour=8, minute=0, second=0, microsecond=0) end_time = tomorrow.replace(hour=13, minute=0, second=0, microsecond=0) payload = { "schedules": [ "YYI9910@infocert.it", "giovanni.albero@infocert.it" ], "start_time": start_time.isoformat(), "end_time": end_time.isoformat(), "availability_view_interval": 30 } response = requests.post(f"{BASE_URL}/calendar/getSchedule", json=payload) print(f"Status Code: {response.status_code}") if response.status_code == 200: data = response.json() print(f"Success: {data.get('success')}") print(f"Schedules Retrieved: {len(data.get('schedules', []))}") for schedule in data.get('schedules', []): email = schedule.get('scheduleId', 'N/A') availability = schedule.get('availabilityView', 'N/A') print(f"\n User: {email}") print(f" Availability View: {availability}") print(f" Schedule Items: {len(schedule.get('scheduleItems', []))}") return True else: print(f"Error: {response.text}") return False def test_create_online_meeting(): """Test creating a Teams online meeting via calendar event.""" print("\n\n=== Test 3: Create Calendar Event with Teams Meeting ===") # Create meeting for tomorrow at 10 AM tomorrow = datetime.now() + timedelta(days=1) start_time = tomorrow.replace(hour=10, minute=0, second=0, microsecond=0) end_time = start_time + timedelta(hours=1) payload = { "subject": "Test Teams Meeting - MCP Server", "start_datetime": start_time.isoformat() + "Z", "end_datetime": end_time.isoformat() + "Z", "body": "Meeting created via MCP Server for testing", "attendees": ["giovanni.albero@infocert.it"], "is_online_meeting": True } response = requests.post(f"{BASE_URL}/calendar/events", json=payload) print(f"Status Code: {response.status_code}") if response.status_code == 200: data = response.json() print(f"Success: {data.get('success')}") event = data.get('event', {}) online_meeting = event.get('onlineMeeting', {}) print(f"\nCalendar Event with Teams Meeting Created:") print(f" ID: {event.get('id', 'N/A')[:50]}...") print(f" Subject: {event.get('subject')}") print(f" isOnlineMeeting: {event.get('isOnlineMeeting')}") print(f" Teams Join URL: {online_meeting.get('joinUrl', 'N/A')[:80]}...") print(f" Start: {event.get('start', {}).get('dateTime')}") print(f" End: {event.get('end', {}).get('dateTime')}") return True else: print(f"Error: {response.text}") return False def main(): """Run all tests.""" print("=" * 60) print("Testing New Meeting Scheduling Endpoints") print("=" * 60) results = [] # Test 1: Find Meeting Times results.append(("Find Meeting Times", test_find_meeting_times())) # Test 2: Get Schedule results.append(("Get Schedule", test_get_schedule())) # Test 3: Create Calendar Event with Teams Meeting results.append(("Create Calendar Event with Teams Meeting", test_create_online_meeting())) # Summary print("\n\n" + "=" * 60) print("TEST SUMMARY") print("=" * 60) passed = sum(1 for _, result in results if result) total = len(results) for test_name, result in results: status = "✅ PASS" if result else "❌ FAIL" print(f"{status} - {test_name}") print(f"\nTotal: {passed}/{total} passed ({passed/total*100:.1f}%)") if __name__ == "__main__": main()

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/ilvolodel/iris-legacy'

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