19 lines
1.2 KiB
Bash
19 lines
1.2 KiB
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
set -e
|
||
|
|
BASE=http://localhost:8080
|
||
|
|
ITOK=dev-ingest-token-1234
|
||
|
|
|
||
|
|
JWT=$(curl -s -XPOST $BASE/api/auth/login -H 'Content-Type: application/json' \
|
||
|
|
-d '{"username":"admin","password":"admin-password-1234"}' \
|
||
|
|
| node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).token))")
|
||
|
|
echo "auth ok"
|
||
|
|
|
||
|
|
curl -sf -XPOST $BASE/api/ingest -H "Authorization: Bearer $ITOK" -H 'Content-Type: application/json' \
|
||
|
|
-d '{"inquiry":{"inquiryId":"E2E-1","createTime":"2026-07-13T10:00:00Z","updateTime":"2026-07-13T10:00:00Z","manager":"tester","status":"new"},"customer":{"customerId":"c-e2e","name":"Test Buyer","country":"US"},"messages":[{"messageId":"e2e-m1","sendTime":"2026-07-13T10:00:00Z","direction":"outgoing","content":"hello e2e"}]}' >/dev/null
|
||
|
|
echo "ingest ok"
|
||
|
|
|
||
|
|
curl -sf "$BASE/api/inquiries/E2E-1" -H "Authorization: Bearer $JWT" | grep -q E2E-1 && echo "detail ok"
|
||
|
|
curl -sf "$BASE/api/inquiries/E2E-1/messages" -H "Authorization: Bearer $JWT" | grep -q e2e-m1 && echo "messages ok"
|
||
|
|
curl -sf "$BASE/api/stats/overview" -H "Authorization: Bearer $JWT" | grep -q total && echo "stats ok"
|
||
|
|
curl -sf "$BASE/api/export" -H "Authorization: Bearer $JWT" | grep -q E2E-1 && echo "export ok"
|