they don't have any output on success, but do report the particular
test on failure.
-echo 'access token ready, pop server accepts message'
+start_test 'access token ready, pop server accepts message'
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
-echo 'expired access token, refresh works, pop server accepts message'
+start_test 'expired access token, refresh works, pop server accepts message'
fake_creds <<EOF
access: old-access
fake_creds <<EOF
access: old-access
-echo 'refresh gets proper error from http'
+start_test 'refresh gets proper error from http'
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
-echo 'pop server rejects token'
+start_test 'pop server rejects token'
fake_creds <<EOF
access: wrong-access
fake_creds <<EOF
access: wrong-access
test_inc 'inc: -ERR [AUTH] Invalid credentials.'
# TEST
test_inc 'inc: -ERR [AUTH] Invalid credentials.'
# TEST
-echo "pop server doesn't support oauth"
+start_test "pop server doesn't support oauth"
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
test_inc 'inc: POP server does not support SASL'
clean_fakehttp
test_inc 'inc: POP server does not support SASL'
clean_fakehttp
-echo 'mhlogin receives access and expiration'
+start_test 'mhlogin receives access and expiration'
-echo 'mhlogin receives access and refresh'
+start_test 'mhlogin receives access and refresh'
-echo 'mhlogin receives access, expiration, and refresh'
+start_test 'mhlogin receives access, expiration, and refresh'
-echo 'mhlogin receives refresh only'
+start_test 'mhlogin receives refresh only'
-echo 'mhlogin receives token_type only'
+start_test 'mhlogin receives token_type only'
test_mhlogin_invalid_response
# TEST
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin ignores extra bits in successful response JSON'
+start_test 'mhlogin ignores extra bits in successful response JSON'
-echo 'mhlogin user enters bad code'
+start_test 'mhlogin user enters bad code'
-echo 'mhlogin response has no content-type'
+start_test 'mhlogin response has no content-type'
test_mhlogin_invalid_response
# TEST
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin JSON array'
+start_test 'mhlogin JSON array'
test_mhlogin_invalid_response
# TEST
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin JSON empty object'
+start_test 'mhlogin JSON empty object'
test_mhlogin_invalid_response
# TEST
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin empty response body'
+start_test 'mhlogin empty response body'
test_mhlogin_invalid_response
# TEST
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin gets proper error from http'
+start_test 'mhlogin gets proper error from http'
mhlogin: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
clean_fakehttp
mhlogin: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
clean_fakehttp
XOAUTH='dXNlcj1ub2JvZHlAZXhhbXBsZS5jb20BYXV0aD1CZWFyZXIgdGVzdC1hY2Nlc3MBAQ=='
# TEST
XOAUTH='dXNlcj1ub2JvZHlAZXhhbXBsZS5jb20BYXV0aD1CZWFyZXIgdGVzdC1hY2Nlc3MBAQ=='
# TEST
-echo 'access token ready, smtp server accepts message'
+start_test 'access token ready, smtp server accepts message'
run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice test -user nobody@example.com"
# TEST
run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice test -user nobody@example.com"
# TEST
-echo 'expired access token, refresh works, smtp server accepts message'
+start_test 'expired access token, refresh works, smtp server accepts message'
-echo 'expired access token, refresh works and gets updated, smtp server accepts message'
+start_test 'expired access token, refresh works and gets updated, smtp server accepts message'
-echo 'access token has no expiration, refresh works, smtp server accepts message'
+start_test 'access token has no expiration, refresh works, smtp server accepts message'
-echo 'no access token, refresh works, smtp server accepts message'
+start_test 'no access token, refresh works, smtp server accepts message'
-echo 'no service definition'
+start_test 'no service definition'
run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice bogus -user nobody@example.com" 'send: incomplete OAuth2 service definition: scope is missing'
# TEST
run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice bogus -user nobody@example.com" 'send: incomplete OAuth2 service definition: scope is missing'
# TEST
-echo 'no creds file -- should tell user to mhlogin'
+start_test 'no creds file -- should tell user to mhlogin'
rm -f "${MHTMPDIR}/oauth-test"
test_send_no_servers 'send: no credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
rm -f "${MHTMPDIR}/oauth-test"
test_send_no_servers 'send: no credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
-echo 'empty creds file -- should tell user to mhlogin'
+start_test 'empty creds file -- should tell user to mhlogin'
fake_creds < /dev/null
test_send_no_servers 'send: no valid credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
fake_creds < /dev/null
test_send_no_servers 'send: no valid credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
-echo 'garbage creds file'
+start_test 'garbage creds file'
send: error loading cred file'
# TEST
send: error loading cred file'
# TEST
-echo 'unexpected field in creds file'
+start_test 'unexpected field in creds file'
fake_creds <<EOF
bork: bork
fake_creds <<EOF
bork: bork
test_send_no_servers 'send: error loading cred file: unexpected field'
# TEST
test_send_no_servers 'send: error loading cred file: unexpected field'
# TEST
-echo 'garbage expiration time'
+start_test 'garbage expiration time'
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
test_send_no_servers 'send: error loading cred file: invalid expiration time'
# TEST
test_send_no_servers 'send: error loading cred file: invalid expiration time'
# TEST
-echo 'refresh response has no access token'
+start_test 'refresh response has no access token'
fake_creds <<EOF
refresh: test-refresh
fake_creds <<EOF
refresh: test-refresh
send: invalid response: no access token'
# TEST
send: invalid response: no access token'
# TEST
-echo 'expired access token, no refresh token -- tell user to mhlogin'
+start_test 'expired access token, no refresh token -- tell user to mhlogin'
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
test_send_no_servers 'send: no valid credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
test_send_no_servers 'send: no valid credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
-echo 'access token has no expiration, no refresh token -- tell user to mhlogin'
+start_test 'access token has no expiration, no refresh token -- tell user to mhlogin'
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
test_send_no_servers 'send: no valid credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
test_send_no_servers 'send: no valid credentials -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
-echo 'refresh finds no http server'
+start_test 'refresh finds no http server'
fake_creds <<EOF
access: test-access
fake_creds <<EOF
access: test-access
-echo 'refresh gets bogus 200 response from http server'
+start_test 'refresh gets bogus 200 response from http server'
send: invalid response'
# TEST
send: invalid response'
# TEST
-echo 'refresh gets 500 response from http server'
+start_test 'refresh gets 500 response from http server'
send: invalid response'
# TEST
send: invalid response'
# TEST
-echo 'refresh gets proper error from http'
+start_test 'refresh gets proper error from http'
test_send_only_fakehttp 'send: credentials rejected -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
test_send_only_fakehttp 'send: credentials rejected -- run mhlogin -saslmech xoauth2 -authservice test'
# TEST
-echo 'refresh gets response too big'
+start_test 'refresh gets response too big'
fake_creds <<EOF
refresh: test-refresh
fake_creds <<EOF
refresh: test-refresh
send: refusing to process response body larger than 8192 bytes'
# TEST
send: refusing to process response body larger than 8192 bytes'
# TEST
-echo 'smtp server rejects token'
+start_test 'smtp server rejects token'
send: message not delivered to anyone'
# TEST
send: message not delivered to anyone'
# TEST
-echo "smtp server doesn't support oauth"
+start_test "smtp server doesn't support oauth"
clean_fakesmtp
clean_fakehttp
clean_fakesmtp
clean_fakehttp
XOAUTH='dXNlcj1ub2JvZHlAZXhhbXBsZS5jb20BYXV0aD1CZWFyZXIgdGVzdC1hY2Nlc3MBAQ=='
# TEST
XOAUTH='dXNlcj1ub2JvZHlAZXhhbXBsZS5jb20BYXV0aD1CZWFyZXIgdGVzdC1hY2Nlc3MBAQ=='
# TEST
-echo 'mhlogin then all run with no refresh'
+start_test 'mhlogin then all run with no refresh'
test_send_only_fakesmtp
# TEST
test_send_only_fakesmtp
# TEST
+start_test 'inc refreshes'
fake_creds <<EOF
access: old-access
fake_creds <<EOF
access: old-access
test_send_only_fakesmtp
# TEST
test_send_only_fakesmtp
# TEST
-echo 'msgchck refreshes'
+start_test 'msgchck refreshes'
fake_creds <<EOF
access: old-access
fake_creds <<EOF
access: old-access
test_send_only_fakesmtp
# TEST
test_send_only_fakesmtp
# TEST
+start_test 'send refreshes'
fake_creds <<EOF
access: old-access
fake_creds <<EOF
access: old-access
clean_fakesmtp
clean_fakehttp
clean_fakesmtp
clean_fakehttp