Compare commits
1 Commits
a083c4f2b5
...
cc3fffbda1
| Author | SHA1 | Date | |
|---|---|---|---|
| cc3fffbda1 |
61
.github/workflows/test.yml
vendored
61
.github/workflows/test.yml
vendored
@@ -163,7 +163,7 @@ jobs:
|
||||
echo "::error::API not accessible after 60 seconds"
|
||||
exit 1
|
||||
|
||||
- name: Debug - List created domains and users
|
||||
- name: Verify domains and users were created
|
||||
run: |
|
||||
echo "=== Reading Admin Password ==="
|
||||
if [ -f /tmp/stalwart_admin_password ]; then
|
||||
@@ -175,30 +175,69 @@ jobs:
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Listing Domains via API ==="
|
||||
echo "=== Verifying Domains ==="
|
||||
DOMAINS_RESPONSE=$(curl -s -u "admin:$ADMIN_PASSWORD" \
|
||||
"http://localhost:8080/api/principal?types=domain&limit=100")
|
||||
echo "$DOMAINS_RESPONSE" | jq '.data.items[] | {name, description, id}'
|
||||
|
||||
DOMAIN_COUNT=$(echo "$DOMAINS_RESPONSE" | jq '.data.total // 0')
|
||||
echo "Total domains: $DOMAIN_COUNT"
|
||||
echo "Total domains found: $DOMAIN_COUNT"
|
||||
|
||||
# List domains
|
||||
echo "$DOMAINS_RESPONSE" | jq -r '.data.items[] | " - \(.name): \(.description // "No description")"'
|
||||
|
||||
# Verify specific domains exist
|
||||
if echo "$DOMAINS_RESPONSE" | jq -e '.data.items[] | select(.name == "test1.local")' >/dev/null; then
|
||||
echo "✓ Domain test1.local exists"
|
||||
else
|
||||
echo "::error::Domain test1.local not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if echo "$DOMAINS_RESPONSE" | jq -e '.data.items[] | select(.name == "test2.local")' >/dev/null; then
|
||||
echo "✓ Domain test2.local exists"
|
||||
else
|
||||
echo "::error::Domain test2.local not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Listing Users via API ==="
|
||||
echo "=== Verifying Users ==="
|
||||
USERS_RESPONSE=$(curl -s -u "admin:$ADMIN_PASSWORD" \
|
||||
"http://localhost:8080/api/principal?types=individual&limit=100")
|
||||
echo "$USERS_RESPONSE" | jq '.data.items[] | {name, emails, roles, id}'
|
||||
|
||||
USER_COUNT=$(echo "$USERS_RESPONSE" | jq '.data.total // 0')
|
||||
echo "Total users: $USER_COUNT"
|
||||
echo "Total users found: $USER_COUNT"
|
||||
|
||||
# Verify expected users exist
|
||||
if [ "$USER_COUNT" -ge 3 ]; then
|
||||
echo "✓ Expected number of users created"
|
||||
else
|
||||
# List users
|
||||
echo "$USERS_RESPONSE" | jq -r '.data.items[] | " - \(.name) (\(.emails[0])): roles=\(.roles)"'
|
||||
|
||||
# Verify we have at least the 3 users we created
|
||||
if [ "$USER_COUNT" -lt 3 ]; then
|
||||
echo "::error::Expected at least 3 users, found $USER_COUNT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify specific users exist and have correct roles
|
||||
for user_email in "user1@test1.local" "user2@test1.local" "admin@test2.local"; do
|
||||
USER_DATA=$(echo "$USERS_RESPONSE" | jq --arg email "$user_email" '.data.items[] | select(.emails[] == $email)')
|
||||
|
||||
if [ -z "$USER_DATA" ]; then
|
||||
echo "::error::User $user_email not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if user has "user" role
|
||||
HAS_USER_ROLE=$(echo "$USER_DATA" | jq '.roles | contains(["user"])')
|
||||
if [ "$HAS_USER_ROLE" = "true" ]; then
|
||||
echo "✓ User $user_email exists with 'user' role"
|
||||
else
|
||||
echo "::error::User $user_email exists but missing 'user' role"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "✓ All domains and users verified successfully"
|
||||
|
||||
- name: Verify unauthenticated JMAP access
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user