diff --git a/scripts/live-test.sh b/scripts/live-test.sh index 9b35b0d..0bac98d 100755 --- a/scripts/live-test.sh +++ b/scripts/live-test.sh @@ -28,6 +28,7 @@ Options: Skip keys (base): time, version, completion, auth, auth-alias, config, enable-commands, gmail, gmail-settings, gmail-delegates, gmail-batch-delete, gmail-history, gmail-url, gmail-labels, + gmail-send-safety, gmail-forward, gmail-attachments, gmail-track, gmail-watch, drive, docs, sheets, slides, calendar, calendar-enterprise, calendar-respond, calendar-team, calendar-users, tasks, contacts, people, groups, keep, classroom diff --git a/scripts/live-tests/core.sh b/scripts/live-tests/core.sh index ab60d4d..b56b44d 100644 --- a/scripts/live-tests/core.sh +++ b/scripts/live-tests/core.sh @@ -45,5 +45,11 @@ run_core_tests() { else echo "gmail-no-send block OK" fi + if $BIN --gmail-no-send gmail fwd msg-1 --to nobody@example.com >/dev/null 2>&1; then + echo "Expected gmail-no-send to block forward alias, but it succeeded" >&2 + exit 1 + else + echo "gmail-no-send forward alias block OK" + fi fi } diff --git a/scripts/live-tests/gmail.sh b/scripts/live-tests/gmail.sh index c8f911a..a5bcbd5 100644 --- a/scripts/live-tests/gmail.sh +++ b/scripts/live-tests/gmail.sh @@ -138,11 +138,30 @@ run_gmail_tests() { send_thread_id=$(extract_field "$send_json" threadId) [ -n "$send_msg_id" ] || { echo "Failed to parse send message id" >&2; exit 1; } + if skip "gmail-send-safety"; then + echo "==> gmail send no-send block (skipped)" + elif gog --gmail-no-send gmail send --to "$EMAIL_TEST" --subject "blocked $TS" --body "blocked" --json >/dev/null 2>&1; then + echo "Expected gmail-no-send to block gmail send, but it succeeded" >&2 + exit 1 + else + echo "gmail send no-send block OK" + fi + local message_json history_id echo "==> gmail get message" message_json=$(gog gmail get "$send_msg_id" --json) history_id=$(extract_history_id "$message_json") + run_required "gmail-forward" "gmail forward dry-run" gog --dry-run gmail forward "$send_msg_id" --to "$EMAIL_TEST" --note "dry-run smoke $TS" --json >/dev/null + if skip "gmail-forward"; then + echo "==> gmail forward no-send block (skipped)" + elif gog --gmail-no-send gmail forward "$send_msg_id" --to "$EMAIL_TEST" --note "blocked $TS" --json >/dev/null 2>&1; then + echo "Expected gmail-no-send to block gmail forward, but it succeeded" >&2 + exit 1 + else + echo "gmail forward no-send block OK" + fi + if [ -n "$history_id" ]; then run_optional "gmail-history" "gmail history" gog gmail history --since "$history_id" --json --max 5 >/dev/null else