]> diplodocus.org Git - nmh/blobdiff - test/oauth/test-mhlogin
test mhlogin -browser
[nmh] / test / oauth / test-mhlogin
index 7f2bcc4ab6b69f9ead7731e9ec6c8ffa1d85f68b..e1ecb20a9c8b212a0cf7a59a426264b7f687861a 100755 (executable)
@@ -254,6 +254,20 @@ expect_no_creds
 test_mhlogin 'mhlogin: error exchanging code for OAuth2 token
 mhlogin: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
 
 test_mhlogin 'mhlogin: error exchanging code for OAuth2 token
 mhlogin: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
 
+# TEST
+start_test 'mhlogin -browser'
+
+run_test "eval echo code | mhlogin -saslmech xoauth2 -authservice test\
+ -browser 'echo \$@ > ${MHTMPDIR}/$$.browser'" \
+"Follow the prompts in your browser to authorize nmh to access test.
+Enter the authorization code: mhlogin: error exchanging code for OAuth2 token
+mhlogin: error making HTTP request to OAuth2 authorization endpoint: Failed to connect to 127.0.0.1 port ${http_port}: Connection refused"
+
+cat > "${MHTMPDIR}/$$.browser.expected" <<EOF
+http://127.0.0.1:64001/oauth/auth?response_type=code&client_id=test-id&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=test-scope
+EOF
+check "${MHTMPDIR}/$$.browser" "${MHTMPDIR}/$$.browser.expected"
+
 clean_fakehttp
 finish_test
 
 clean_fakehttp
 finish_test