]>
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 start_test
'mhlogin then all run with no refresh'
23 fake_json_response
<<EOF
25 "access_token": "test-access",
26 "token_type": "Bearer",
32 access-nobody@example.com: test-access
33 expire-nobody@example.com:
37 run_test
'eval echo code | mhlogin -user nobody@example.com -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
54 start_test
'inc refreshes'
57 access-nobody@example.com: old-access
58 refresh-nobody@example.com: test-refresh
59 expire-nobody@example.com: 1414303986
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 start_test
'msgchck refreshes'
86 access-nobody@example.com: old-access
87 refresh-nobody@example.com: test-refresh
88 expire-nobody@example.com: 1414303986
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 start_test
'send refreshes'
115 access-nobody@example.com: old-access
116 refresh-nobody@example.com: test-refresh
117 expire-nobody@example.com: 1414303986
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'