# shellcheck shell=bash # Scenarios set what the runner and items read # shellcheck disable=SC2034 DESCRIPTION="Email, calendars and contacts in GNOME Online Accounts 3.50, without GNOME" TIER=quick scenario() { local G="$CONNECTOR/configure.d/lib/goa-account" out step "Installing GNOME Online Accounts and Evolution's data server" # Evolution itself is large and only shows what's here; its data server is # what reads Online Accounts sudo apt-get update > /dev/null && sudo apt-get install -y gnome-online-accounts evolution-data-server > /dev/null 2>&1 check "gnome-online-accounts is installed" pkg_installed gnome-online-accounts source "$CONNECTOR/configure.d/10-core.sh" goa_ready() { return 0; } CORE_DOMAIN=smoke.invalid CORE_EMAIL=jo@smoke.invalid CORE_NAME='Jo "Q" Tester' core_names PASSWORD='p\ss "word"' APP_PASSWORD=app-password-1 step "Adding the accounts" check "setup_nextcloud" setup_nextcloud check "setup_email, with the usual servers when the domain has no autoconfig" setup_email check "nextcloud_done" nextcloud_done check "email_done" email_done check "adding again changes nothing" setup_email check_eq "there's one email account" 1 "$(grep -c '^Provider=imap_smtp' "$HOME/.config/goa-1.0/accounts.conf")" check "IMAP is mail.smoke.invalid over SSL" grep -qx 'ImapHost=mail.smoke.invalid' "$HOME/.config/goa-1.0/accounts.conf" check "SMTP uses STARTTLS on 587" grep -qx 'SmtpUseTls=true' "$HOME/.config/goa-1.0/accounts.conf" check "the name survives quoting" grep -qxF 'Name=Jo "Q" Tester' "$HOME/.config/goa-1.0/accounts.conf" check_eq "nothing is turned off" "" "$("$G" disabled owncloud "$CORE_USER@nextcloud.$CORE_DOMAIN")" step "Pausing email, as email-watch does" check_not "not paused at first" "$G" paused imap_smtp "$CORE_EMAIL" check "pause" "$G" pause imap_smtp "$CORE_EMAIL" check "paused" "$G" paused imap_smtp "$CORE_EMAIL" jq -n '{"imap-password": "new", "smtp-password": "new"}' | "$G" update imap_smtp "$CORE_EMAIL" 2> /dev/null check_eq "update saves the password; the server can't be reached, so it exits 3" 3 $? check_not "update ends the pause" "$G" paused imap_smtp "$CORE_EMAIL" step "Test a Core's account checks" "$CONNECTOR/system/email-watch" --check-password "$CORE_EMAIL" check_eq "email-watch can't tell without Nextcloud (1)" 1 $? FIXES=() FIX_TITLES=() PROBLEMS=0 out="$(test_account "Email" imap_smtp "$CORE_EMAIL" setup_email fix_email enable_email)" check "an unreachable mail server is a sign-in failure, not a wrong password" grep -q "can't sign in" <<< "$out" check_not "...and isn't taken as an old password" grep -q "old password" <<< "$out" step "Removing" check "remove owncloud" "$G" remove owncloud "$CORE_USER@nextcloud.$CORE_DOMAIN" check "remove imap_smtp" "$G" remove imap_smtp "$CORE_EMAIL" check_not "nothing left" email_done check "no passwords left in the keyring" bash -c '! secret-tool search --all xdg:schema org.gnome.OnlineAccounts 2>&1 | grep -q goa-identity' }