-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-interfaces-simple.sh
More file actions
executable file
·162 lines (132 loc) · 4.71 KB
/
Copy pathtest-interfaces-simple.sh
File metadata and controls
executable file
·162 lines (132 loc) · 4.71 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/bash
echo "🚀 Testing Admin and Auditor Interfaces..."
echo
# Test if development server is running
echo "📡 Checking if development server is running..."
if curl -s -f http://localhost:3000 > /dev/null; then
echo "✅ Development server is running"
else
echo "❌ Development server is not running"
echo "Please run 'npm run dev' in the app directory first"
exit 1
fi
echo
# Test Admin Interface
echo "📊 Testing Admin Interface..."
ADMIN_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:3000/demo/admin -o /tmp/admin_response.html)
if [ "$ADMIN_RESPONSE" = "200" ]; then
echo "✅ Admin page loads successfully (HTTP 200)"
# Check for key admin elements in the response
if grep -q "Privacy Administration" /tmp/admin_response.html; then
echo "✅ Admin page title found"
else
echo "❌ Admin page title not found"
fi
if grep -q "Active Policies" /tmp/admin_response.html; then
echo "✅ Admin metrics cards found"
else
echo "❌ Admin metrics cards not found"
fi
if grep -q "System Health" /tmp/admin_response.html; then
echo "✅ System health monitoring found"
else
echo "❌ System health monitoring not found"
fi
else
echo "❌ Admin page failed to load (HTTP $ADMIN_RESPONSE)"
fi
echo
# Test Auditor Interface
echo "🔍 Testing Auditor Interface..."
AUDITOR_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:3000/demo/auditor -o /tmp/auditor_response.html)
if [ "$AUDITOR_RESPONSE" = "200" ]; then
echo "✅ Auditor page loads successfully (HTTP 200)"
# Check for key auditor elements in the response
if grep -q "Compliance Auditor" /tmp/auditor_response.html; then
echo "✅ Auditor page title found"
else
echo "❌ Auditor page title not found"
fi
if grep -q "Blockchain Height" /tmp/auditor_response.html; then
echo "✅ Blockchain metrics found"
else
echo "❌ Blockchain metrics not found"
fi
if grep -q "Consent Audit" /tmp/auditor_response.html; then
echo "✅ Consent audit functionality found"
else
echo "❌ Consent audit functionality not found"
fi
if grep -q "Proof Generation" /tmp/auditor_response.html; then
echo "✅ Proof generation functionality found"
else
echo "❌ Proof generation functionality not found"
fi
else
echo "❌ Auditor page failed to load (HTTP $AUDITOR_RESPONSE)"
fi
echo
# Test API endpoints
echo "🌐 Testing API Connectivity..."
# Test health endpoint
HEALTH_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:3005/health -o /tmp/health_response.json)
if [ "$HEALTH_RESPONSE" = "200" ]; then
echo "✅ Health API endpoint working (HTTP 200)"
if grep -q "healthy\|status" /tmp/health_response.json; then
echo "✅ Health API returns valid data"
fi
else
echo "❌ Health API endpoint not working (HTTP $HEALTH_RESPONSE)"
fi
# Test policies endpoint
POLICIES_RESPONSE=$(curl -s -w "%{http_code}" http://localhost:3005/api/v1/policies -H "x-api-key: test-key" -o /tmp/policies_response.json)
if [ "$POLICIES_RESPONSE" = "200" ]; then
echo "✅ Policies API endpoint working (HTTP 200)"
else
echo "❌ Policies API endpoint not working (HTTP $POLICIES_RESPONSE)"
fi
echo
# Summary
echo "📈 Test Summary:"
echo "=================="
ADMIN_SCORE=0
AUDITOR_SCORE=0
if [ "$ADMIN_RESPONSE" = "200" ]; then
ADMIN_SCORE=$((ADMIN_SCORE + 1))
fi
if grep -q "Privacy Administration" /tmp/admin_response.html 2>/dev/null; then
ADMIN_SCORE=$((ADMIN_SCORE + 1))
fi
if grep -q "Active Policies" /tmp/admin_response.html 2>/dev/null; then
ADMIN_SCORE=$((ADMIN_SCORE + 1))
fi
if [ "$AUDITOR_RESPONSE" = "200" ]; then
AUDITOR_SCORE=$((AUDITOR_SCORE + 1))
fi
if grep -q "Compliance Auditor" /tmp/auditor_response.html 2>/dev/null; then
AUDITOR_SCORE=$((AUDITOR_SCORE + 1))
fi
if grep -q "Blockchain Height" /tmp/auditor_response.html 2>/dev/null; then
AUDITOR_SCORE=$((AUDITOR_SCORE + 1))
fi
echo "Admin Interface: $ADMIN_SCORE/3 tests passed"
echo "Auditor Interface: $AUDITOR_SCORE/3 tests passed"
if [ "$HEALTH_RESPONSE" = "200" ]; then
echo "API Health: ✅ Working"
else
echo "API Health: ❌ Not Working"
fi
if [ "$POLICIES_RESPONSE" = "200" ]; then
echo "API Policies: ✅ Working"
else
echo "API Policies: ❌ Not Working"
fi
echo
if [ $ADMIN_SCORE -ge 2 ] && [ $AUDITOR_SCORE -ge 2 ]; then
echo "🎉 Both interfaces are working well!"
echo "✅ Admin and Auditor interfaces successfully finalized!"
else
echo "⚠️ Some features may need attention."
fi
# Cleanup
rm -f /tmp/admin_response.html /tmp/auditor_response.html /tmp/health_response.json /tmp/policies_response.json