X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/29ff4f879ba9eea142df4e8caf436d0dd933218c..be5ee307cc4ab5db4387fea8d5f6b8caf748ab31:/test/oauth/test-send diff --git a/test/oauth/test-send b/test/oauth/test-send index d75901ad..3d1a7bd6 100755 --- a/test/oauth/test-send +++ b/test/oauth/test-send @@ -1,6 +1,6 @@ #!/bin/sh # -# Test the XOAUTH2 support in sen +# Test the XOAUTH2 support in send # if test -z "${MH_OBJ_DIR}"; then @@ -10,6 +10,8 @@ fi . "${srcdir}/test/oauth/common.sh" +check_exit '-eq 1' send - + test_send_only_fakehttp() { start_fakehttp test_send_no_servers "$@" @@ -35,7 +37,7 @@ expire-nobody@example.com: 2000000000 EOF start_fakesmtp -run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice test -user nobody@example.com" +run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com" # TEST start_test 'expired access token, refresh works, smtp server accepts message' @@ -154,6 +156,65 @@ test_send check_creds +# TEST +start_test 'fill all slots in creds table' + +setup_draft + +fake_creds < "${testname}.expected-send-output" < "${testname}.send-output" 2>&1 || true + -sasl -saslmech xoauth2 -authservice test -user nobody@example.com > "${testname}.send-output" 2>&1 || true # Clear out an error message we get from libcurl on some systems (seen at least # 3 different versions of this error message, on FreeBSD 10.1, Ubuntu 12.04, and # Ubuntu 14.04). f="${testname}.send-output" -sed 's/\(send: error making HTTP request to OAuth2 authorization endpoint:\).*/\1 [details]/' "$f" > "$f".clean +sed 's/\(post: error making HTTP request to OAuth2 authorization endpoint:\).*/\1 [details]/' "$f" > "$f".clean check "$f".clean "${testname}.expected-send-output" rm "$f" @@ -279,8 +350,9 @@ Content-Type: text/html doh! EOF -test_send_only_fakehttp 'send: error refreshing OAuth2 token -send: invalid response' +test_send 'post: error refreshing OAuth2 token +post: invalid response +send: message not delivered to anyone' # TEST start_test 'refresh gets 500 response from http server' @@ -293,8 +365,9 @@ Content-Type: text/html doh! EOF -test_send_only_fakehttp 'send: error refreshing OAuth2 token -send: invalid response' +test_send 'post: error refreshing OAuth2 token +post: invalid response +send: message not delivered to anyone' # TEST start_test 'refresh gets proper error from http' @@ -309,7 +382,8 @@ Content-Type: application/json } EOF -test_send_only_fakehttp 'send: credentials rejected -- run mhlogin -saslmech xoauth2 -authservice test' +test_send 'post: credentials rejected -- run mhlogin -saslmech xoauth2 -authservice test +send: message not delivered to anyone' # TEST start_test 'refresh gets response too big' @@ -331,8 +405,9 @@ EOF awk 'BEGIN { for (i = 0; i < 8192; i++) { print "." } }' \ >> "${testname}.http-res" -test_send_only_fakehttp 'send: error refreshing OAuth2 token -send: refusing to process response body larger than 8192 bytes' +test_send 'post: error refreshing OAuth2 token +post: refusing to process response body larger than 8192 bytes +send: message not delivered to anyone' # TEST start_test 'smtp server rejects token' @@ -344,7 +419,26 @@ access-nobody@example.com: test-access expire-nobody@example.com: 2000000000 EOF -test_send_only_fakesmtp 'post: problem initializing server; [BHST] Not no way, not no how! +test_send_only_fakesmtp 'post: problem initializing server; [BHST] Authentication failed: Not no way, not no how! +send: message not delivered to anyone' + +# TEST +start_test 'botched json response' + +fake_creds <