-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_integration.py
More file actions
39 lines (33 loc) · 1.58 KB
/
test_integration.py
File metadata and controls
39 lines (33 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3
"""
Quick test script to verify OrderContract integration
Run this after setting up your .env file with actual contract addresses
"""
import asyncio
from blockchain.order_service import order_contract_service
async def test_integration():
"""Test the OrderContract integration"""
print("🧪 Testing OrderContract Integration...")
# Test 1: Check service info (should work without initialization)
print("\n1. Checking service status...")
service_info = order_contract_service.get_service_info()
print(f" Service initialized: {service_info.get('initialized', False)}")
# Test 2: Try to initialize (will fail without proper env vars, but should not crash)
print("\n2. Testing initialization (will fail without proper .env)...")
try:
success = await order_contract_service.initialize_service(
order_contract_address="0x1234567890123456789012345678901234567890", # Dummy address
agent_controller_private_key=None
)
print(f" Initialization success: {success}")
except Exception as e:
print(f" Expected error (need real addresses): {type(e).__name__}")
print("\n✅ Integration test complete!")
print("\n📋 Next steps:")
print(" 1. Copy .env.example to .env")
print(" 2. Update .env with your contract addresses and keys")
print(" 3. Start your FastAPI server: python app.py")
print(" 4. Initialize service: POST /orders/initialize")
print(" 5. Test endpoints: GET /orders/health")
if __name__ == "__main__":
asyncio.run(test_integration())