-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest-endpoints.sh
More file actions
93 lines (81 loc) · 2.12 KB
/
test-endpoints.sh
File metadata and controls
93 lines (81 loc) · 2.12 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Test script for Clearing Kernel endpoints
BASE_URL="http://localhost:3000"
echo "Testing Clearing Kernel Endpoints"
echo "=================================="
echo ""
# FREE TIER ENDPOINTS
echo "1. Testing GET /v1/spec"
curl -s $BASE_URL/v1/spec | jq '.'
echo ""
echo "2. Testing GET /healthz"
curl -s $BASE_URL/healthz | jq '.'
echo ""
echo "3. Testing POST /v1/verify (MSR)"
curl -s -X POST $BASE_URL/v1/verify \
-H "Content-Type: application/json" \
-d '{
"type": "msr",
"payload": {
"payload": {"test": "data"},
"signatures": []
}
}' | jq '.'
echo ""
# PAID TIER ENDPOINTS
echo "4. Testing POST /v1/net (should return 402)"
curl -s -X POST $BASE_URL/v1/net \
-H "Content-Type: application/json" \
-d '{
"agent_id": "test_agent",
"receipts": []
}' | jq '.'
echo ""
echo "5. Testing POST /v1/credit/packs"
curl -s -X POST $BASE_URL/v1/credit/packs | jq '.'
echo ""
echo "6. Testing POST /v1/credit/open"
curl -s -X POST $BASE_URL/v1/credit/open \
-H "Content-Type: application/json" \
-d '{
"agent_id": "test_agent",
"mbs": "test_mbs",
"limit_usd_micros": 1000000000,
"terms_hash": "abc123"
}' | jq '.'
echo ""
echo "7. Testing POST /v1/fc/commit"
curl -s -X POST $BASE_URL/v1/fc/commit \
-H "Content-Type: application/json" \
-d '{
"agent_id": "test_agent",
"fc": {
"certificate_hash": "abc123",
"conformance_level": "gold",
"timestamp": 1234567890
}
}' | jq '.'
echo ""
echo "8. Testing POST /v1/default/trigger"
curl -s -X POST $BASE_URL/v1/default/trigger \
-H "Content-Type: application/json" \
-d '{
"agent_id": "test_agent",
"reason_code": "insufficient_collateral"
}' | jq '.'
echo ""
echo "9. Testing POST /v1/seal/verify"
curl -s -X POST $BASE_URL/v1/seal/verify \
-H "Content-Type: application/json" \
-d '{
"seal": {
"target_base_url": "https://example.com",
"conformance_report_hash": "abc123",
"issued_at": 1234567890,
"issued_by": "clearing-kernel",
"signature": "invalid"
}
}' | jq '.'
echo ""
echo "=================================="
echo "All endpoint tests complete!"