X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/b9e0388a118e84f002ae0da6c7a31bdbd89a73bb..a69b69121b49e6de84d0e8bf0e39ba3a96b67188:/test/oauth/test-send?ds=sidebyside diff --git a/test/oauth/test-send b/test/oauth/test-send index 1c5ae4bf..7fa7bfb1 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 - # gcov + test_send_only_fakehttp() { start_fakehttp test_send_no_servers "$@" @@ -24,28 +26,28 @@ export XOAUTH XOAUTH='dXNlcj1ub2JvZHlAZXhhbXBsZS5jb20BYXV0aD1CZWFyZXIgdGVzdC1hY2Nlc3MBAQ==' # TEST -echo 'access token ready, smtp server accepts message' +start_test 'access token ready, smtp server accepts message' 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" # TEST -echo 'refresh gets bogus 200 response from http server' +start_test 'refresh gets bogus 200 response from http server' expect_http_post_refresh @@ -279,11 +291,12 @@ 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 -echo 'refresh gets 500 response from http server' +start_test 'refresh gets 500 response from http server' expect_http_post_refresh @@ -293,11 +306,12 @@ 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 -echo 'refresh gets proper error from http' +start_test 'refresh gets proper error from http' expect_http_post_refresh @@ -309,13 +323,14 @@ Content-Type: application/json } EOF -test_send_only_fakehttp 'send: credentials rejected -- run mhlogin -oath test' +test_send 'post: credentials rejected -- run mhlogin -saslmech xoauth2 -authservice test +send: message not delivered to anyone' # TEST -echo 'refresh gets response too big' +start_test 'refresh gets response too big' fake_creds <> "${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 -echo 'smtp server rejects token' +start_test 'smtp server rejects token' XOAUTH='not-that-one' fake_creds <