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"
13 check_exit
'-eq 1' inc
- # gcov
22 start_test
'access token ready, pop server accepts message'
25 access-nobody@example.com: test-access
26 expire-nobody@example.com: 2000000000
34 start_test
'expired access token, refresh works, pop server accepts message'
37 access-nobody@example.com: old-access
38 refresh-nobody@example.com: test-refresh
39 expire-nobody@example.com: 1414303986
42 expect_http_post_refresh
44 fake_json_response
<<EOF
46 "access_token": "test-access",
47 "token_type": "Bearer",
64 start_test
'refresh gets proper error from http'
67 access-nobody@example.com: test-access
68 refresh-nobody@example.com: test-refresh
71 expect_http_post_refresh
73 fake_http_response
'400 Bad Request' <<EOF
74 Content-Type: application/json
77 "error": "invalid_request"
84 test_inc
'inc: error refreshing OAuth2 token
85 inc: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
90 start_test
'pop server rejects token'
93 access-nobody@example.com: wrong-access
94 expire-nobody@example.com: 2000000000
99 test_inc
'inc: Authentication failed: -ERR [AUTH] Invalid credentials.'
102 start_test
"pop server doesn't support oauth"
105 access-nobody@example.com: test-access
106 expire-nobody@example.com: 2000000000
109 start_pop testuser testpass
111 test_inc
'inc: POP server does not support SASL'