accessibilitychecker commited on
Commit
cd42042
Β·
verified Β·
1 Parent(s): 361740d

Delete test-endpoints.sh

Browse files
Files changed (1) hide show
  1. test-endpoints.sh +0 -79
test-endpoints.sh DELETED
@@ -1,79 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Color codes for output
4
- RED='\033[0;31m'
5
- GREEN='\033[0;32m'
6
- YELLOW='\033[1;33m'
7
- NC='\033[0m' # No Color
8
-
9
- echo "Testing Accessibility Checker Backend Endpoints"
10
- echo "================================================"
11
- echo ""
12
-
13
- BASE_URL="https://accessibility-checker-be.vercel.app"
14
- TEST_DIR="./Accessibility Standards"
15
-
16
- # Test files
17
- FILES=(
18
- "Document Accessibility Matrix_Word.docx"
19
- )
20
-
21
- # Test upload endpoint
22
- echo -e "${YELLOW}Testing Upload Endpoint...${NC}"
23
- for file in "${FILES[@]}"; do
24
- echo -n "Testing: $file ... "
25
- RESPONSE=$(curl -s -X POST \
26
- -H "Content-Type: multipart/form-data" \
27
- -F "file=@${TEST_DIR}/${file}" \
28
- "${BASE_URL}/api/upload-document")
29
-
30
- if echo "$RESPONSE" | grep -q '"fileName"'; then
31
- echo -e "${GREEN}βœ“ PASSED${NC}"
32
- else
33
- echo -e "${RED}βœ— FAILED${NC}"
34
- echo "Response: $RESPONSE"
35
- fi
36
- done
37
-
38
- echo ""
39
- echo -e "${YELLOW}Testing Download Endpoint...${NC}"
40
- for file in "${FILES[@]}"; do
41
- echo -n "Testing: $file ... "
42
-
43
- # Download the file
44
- OUTPUT_FILE="/tmp/remediated-$(echo "$file" | tr ' ' '_')"
45
- HTTP_CODE=$(curl -s -w "%{http_code}" -X POST \
46
- -H "Content-Type: multipart/form-data" \
47
- -F "file=@${TEST_DIR}/${file}" \
48
- "${BASE_URL}/api/download-document" \
49
- -o "$OUTPUT_FILE")
50
-
51
- if [ "$HTTP_CODE" = "200" ]; then
52
- # Verify it's a valid ZIP/DOCX file
53
- if unzip -t "$OUTPUT_FILE" &>/dev/null; then
54
- echo -e "${GREEN}βœ“ PASSED (Valid DOCX)${NC}"
55
- else
56
- echo -e "${RED}βœ— FAILED (Invalid DOCX)${NC}"
57
- fi
58
- else
59
- echo -e "${RED}βœ— FAILED (HTTP $HTTP_CODE)${NC}"
60
- fi
61
- done
62
-
63
- echo ""
64
- echo -e "${YELLOW}Testing CORS Headers...${NC}"
65
- echo -n "Testing OPTIONS preflight ... "
66
- CORS_RESPONSE=$(curl -s -X OPTIONS \
67
- -H "Origin: https://accessibilitychecker25-arch.github.io" \
68
- -H "Access-Control-Request-Method: POST" \
69
- "${BASE_URL}/api/upload-document" -i)
70
-
71
- if echo "$CORS_RESPONSE" | grep -qi "access-control-allow-origin"; then
72
- echo -e "${GREEN}βœ“ PASSED${NC}"
73
- else
74
- echo -e "${RED}βœ— FAILED${NC}"
75
- fi
76
-
77
- echo ""
78
- echo "================================================"
79
- echo "Test Summary Complete"