-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_endpoint.sh
More file actions
executable file
·56 lines (47 loc) · 1.75 KB
/
test_endpoint.sh
File metadata and controls
executable file
·56 lines (47 loc) · 1.75 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
#!/bin/bash
# Quick endpoint test script
echo "Testing Profile Analysis Endpoints"
echo "===================================="
echo ""
# Test if backend is running
echo "1. Checking if backend is running..."
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
echo "✓ Backend is running"
else
echo "✗ Backend is not running"
echo " Start with: cd backend && uvicorn app.main:app --reload"
exit 1
fi
echo ""
echo "2. Testing profile analysis endpoint..."
echo ""
# Test the start endpoint (should return 404 for non-existent user or 400 for no auth)
echo "Testing: POST /api/v1/profile/HarjjotSinghh/analyze/start"
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST http://localhost:8000/api/v1/profile/HarjjotSinghh/analyze/start)
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n-1)
echo "HTTP Status: $HTTP_CODE"
echo "Response: $BODY"
echo ""
if [ "$HTTP_CODE" = "404" ]; then
echo "✓ Endpoint exists (user not found - expected)"
elif [ "$HTTP_CODE" = "400" ]; then
echo "✓ Endpoint exists (no auth token - expected)"
elif [ "$HTTP_CODE" = "200" ]; then
echo "✓ Endpoint exists and analysis started!"
else
echo "✗ Unexpected response code: $HTTP_CODE"
fi
echo ""
echo "3. Testing status endpoint..."
echo "Testing: GET /api/v1/profile/HarjjotSinghh/analyze/status"
STATUS_RESPONSE=$(curl -s http://localhost:8000/api/v1/profile/HarjjotSinghh/analyze/status)
echo "Response: $STATUS_RESPONSE"
echo ""
echo "===================================="
echo "Endpoint test complete!"
echo ""
echo "If you see 404 or 400, that's expected if user hasn't authenticated."
echo "To test fully:"
echo " 1. Login via UI: http://localhost:3000/login"
echo " 2. Then try the 'Analyze Profile' button in dashboard"