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