Compare commits
1 Commits
14b4abf21c
...
103485b4d9
| Author | SHA1 | Date | |
|---|---|---|---|
| 103485b4d9 |
58
.github/workflows/test.yml
vendored
58
.github/workflows/test.yml
vendored
@@ -129,16 +129,13 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
|
||||
# Try to authenticate with new password
|
||||
RESPONSE=$(curl -sf -X POST http://localhost:8080/api/authenticate \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"login":"admin","password":"TestPassword123!@#"}')
|
||||
# Test authentication with Basic Auth (the actual method Stalwart uses)
|
||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-u "admin:TestPassword123!@#" \
|
||||
http://localhost:8080/api/principal?types=domain&limit=1)
|
||||
|
||||
TOKEN=$(echo "$RESPONSE" | jq -r '.token // empty')
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "::error::Failed to authenticate with new password"
|
||||
echo "Response: $RESPONSE"
|
||||
if [ "$HTTP_CODE" != "200" ]; then
|
||||
echo "::error::Authentication failed with HTTP $HTTP_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -227,49 +224,50 @@ jobs:
|
||||
sleep 2
|
||||
done
|
||||
|
||||
RESPONSE=$(curl -sf -X POST http://localhost:8080/api/authenticate \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"login":"admin","password":"AdminPass123!@#"}')
|
||||
# Test authentication with Basic Auth
|
||||
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \
|
||||
-u "admin:AdminPass123!@#" \
|
||||
http://localhost:8080/api/principal?types=domain&limit=1)
|
||||
|
||||
TOKEN=$(echo "$RESPONSE" | jq -r '.token // empty')
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "::error::Failed to authenticate with admin password"
|
||||
echo "Response: $RESPONSE"
|
||||
if [ "$HTTP_CODE" != "200" ]; then
|
||||
echo "::error::Authentication failed with HTTP $HTTP_CODE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Admin authentication successful"
|
||||
echo "TOKEN=$TOKEN" >> $GITHUB_ENV
|
||||
|
||||
- name: Verify domains were created
|
||||
run: |
|
||||
# List domains via API
|
||||
DOMAINS=$(curl -sf -X GET http://localhost:8080/api/domain \
|
||||
-H "Authorization: Bearer $TOKEN")
|
||||
# List domains via API (using discovered endpoint structure)
|
||||
DOMAINS=$(curl -sf \
|
||||
-u "admin:AdminPass123!@#" \
|
||||
"http://localhost:8080/api/principal?types=domain&limit=100")
|
||||
|
||||
echo "Domains response: $DOMAINS"
|
||||
|
||||
# Check if our test domains exist
|
||||
if echo "$DOMAINS" | jq -e '.[] | select(.name == "test1.local")' >/dev/null; then
|
||||
# Check if our test domains exist in data.items array
|
||||
if echo "$DOMAINS" | jq -e '.data.items[] | select(.name == "test1.local")' >/dev/null; then
|
||||
echo "✓ Domain test1.local found"
|
||||
else
|
||||
echo "::warning::Domain test1.local not found (API might use different structure)"
|
||||
echo "::warning::Domain test1.local not found"
|
||||
echo "$DOMAINS" | jq '.data.items[].name' || true
|
||||
fi
|
||||
|
||||
- name: Verify users were created
|
||||
run: |
|
||||
# List accounts via API
|
||||
ACCOUNTS=$(curl -sf -X GET http://localhost:8080/api/account \
|
||||
-H "Authorization: Bearer $TOKEN")
|
||||
# List accounts via API (using discovered endpoint structure)
|
||||
ACCOUNTS=$(curl -sf \
|
||||
-u "admin:AdminPass123!@#" \
|
||||
"http://localhost:8080/api/principal?types=individual&limit=100")
|
||||
|
||||
echo "Accounts response: $ACCOUNTS"
|
||||
|
||||
# Check if users exist
|
||||
if echo "$ACCOUNTS" | jq -e '.[] | select(.name == "user1@test1.local")' >/dev/null; then
|
||||
# Check if users exist in data.items array
|
||||
if echo "$ACCOUNTS" | jq -e '.data.items[] | select(.emails[] == "user1@test1.local")' >/dev/null; then
|
||||
echo "✓ User user1@test1.local found"
|
||||
else
|
||||
echo "::warning::User user1@test1.local not found (API might use different structure)"
|
||||
echo "::warning::User user1@test1.local not found"
|
||||
echo "$ACCOUNTS" | jq '.data.items[].emails[]' || true
|
||||
fi
|
||||
|
||||
- name: Show logs on failure
|
||||
|
||||
Reference in New Issue
Block a user