]>
diplodocus.org Git - nmh/blob - test/oauth/test-share
3 # Test that inc, msgchck, and send share tokens.
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"
16 XOAUTH
='dXNlcj1ub2JvZHlAZXhhbXBsZS5jb20BYXV0aD1CZWFyZXIgdGVzdC1hY2Nlc3MBAQ=='
19 echo 'mhlogin then all run with no refresh'
23 fake_json_response
<<EOF
25 "access_token": "test-access",
26 "token_type": "Bearer",
37 run_test
'eval echo code | mhlogin -saslmech xoauth2 -authservice test' \
38 "Load the following URL in your browser and authorize nmh to access test:
40 http://127.0.0.1:${http_port}/oauth/auth?response_type=code&client_id=test-id&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=test-scope
42 Enter the authorization code: "
45 run_test
"msgchk -host 127.0.0.1 -port ${pop_port} -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
51 test_send_only_fakesmtp
62 expect_http_post_refresh
64 fake_json_response
<<EOF
66 "access_token": "test-access",
67 "token_type": "Bearer",
77 run_test
"msgchk -host 127.0.0.1 -port ${pop_port} -saslmech oauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
80 test_send_only_fakesmtp
83 echo 'msgchck refreshes'
91 expect_http_post_refresh
93 fake_json_response
<<EOF
95 "access_token": "test-access",
96 "token_type": "Bearer",
103 run_test
"msgchk -host 127.0.0.1 -port ${pop_port} -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
109 test_send_only_fakesmtp
112 echo 'send refreshes'
116 refresh: test-refresh
120 expect_http_post_refresh
122 fake_json_response
<<EOF
124 "access_token": "test-access",
125 "token_type": "Bearer",
134 run_test
"msgchk -host 127.0.0.1 -port ${pop_port} -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'