41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test mesh generation API
|
|
"""
|
|
import requests
|
|
import json
|
|
|
|
def test_mesh_generate():
|
|
base_url = 'http://localhost:5000'
|
|
|
|
print("🧪 测试网格生成API")
|
|
print("=" * 40)
|
|
|
|
# Test mesh generation without file
|
|
try:
|
|
response = requests.post(f"{base_url}/api/mesh/generate",
|
|
headers={'Content-Type': 'application/json'},
|
|
timeout=10)
|
|
print(f"网格生成API (无文件): {response.status_code}")
|
|
if response.headers.get('content-type', '').startswith('application/json'):
|
|
data = response.json()
|
|
print(f"响应: {json.dumps(data, indent=2, ensure_ascii=False)}")
|
|
else:
|
|
print(f"响应内容: {response.text[:200]}...")
|
|
except Exception as e:
|
|
print(f"❌ 网格生成API错误: {e}")
|
|
|
|
# Test status API
|
|
try:
|
|
response = requests.get(f"{base_url}/api/mesh/status", timeout=5)
|
|
print(f"\n状态API: {response.status_code}")
|
|
if response.status_code == 200:
|
|
data = response.json()
|
|
print(f"当前状态: {data.get('status', {}).get('status', 'unknown')}")
|
|
else:
|
|
print(f"状态API错误: {response.status_code}")
|
|
except Exception as e:
|
|
print(f"❌ 状态API错误: {e}")
|
|
|
|
if __name__ == '__main__':
|
|
test_mesh_generate() |