#!/usr/bin/env python3 """Test a method we know works - ReadActionMappings""" import asyncio import sys import os sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) from api.protos import configuration_pb2, configuration_pb2_grpc import grpc async def test_methods(): """Test both ReadActionMappings (known working) and ReadConfigurationTree""" channel = grpc.aio.insecure_channel('localhost:50051') stub = configuration_pb2_grpc.ConfigurationServiceStub(channel) # Test ReadActionMappings (should work) print("Testing ReadActionMappings (known to work)...") try: request = configuration_pb2.ReadActionMappingsRequest() response = await stub.ReadActionMappings(request, timeout=10.0) print(f"SUCCESS: Got {len(response.mappings)} action mappings\n") except Exception as e: print(f"FAILED: {e}\n") # Test ReadConfigurationTree print("Testing ReadConfigurationTree (problematic)...") try: request = configuration_pb2.ReadConfigurationTreeRequest() response = await stub.ReadConfigurationTree(request, timeout=10.0) print(f"SUCCESS: Got response with {len(response.root.children)} root children") except Exception as e: print(f"FAILED: {type(e).__name__}") print(f"Details: {e}") await channel.close() if __name__ == "__main__": asyncio.run(test_methods())