3 # Test the XOAUTH2 support in inc
6 if test -z "${MH_OBJ_DIR}"; then
7 srcdir
=`dirname "$0"`/..
/..
8 MH_OBJ_DIR
=`cd "${srcdir}" && pwd`; export MH_OBJ_DIR
11 .
"${srcdir}/test/oauth/common.sh"
20 echo 'access token ready, pop server accepts message'
32 echo 'expired access token, refresh works, pop server accepts message'
40 expect_http_post_refresh
42 fake_json_response
<<EOF
44 "access_token": "test-access",
45 "token_type": "Bearer",
68 echo 'refresh gets proper error from http'
75 expect_http_post_refresh
77 fake_http_response
'400 Bad Request' <<EOF
78 Content-Type: application/json
81 "error": "invalid_request"
87 test_inc
'inc: error refreshing OAuth2 token
88 inc: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
93 echo 'pop server rejects token'
102 test_inc
'inc: -ERR [AUTH] Invalid credentials.'
105 echo "pop server doesn't support oauth"
112 start_pop testuser testpass
114 test_inc
'inc: POP server does not support SASL'