X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/55e00080ba89576b759957b9b20549899df05a2c..b9dda34301de552ad6413e4dd022114fd5219cc9:/test/oauth/test-mhlogin diff --git a/test/oauth/test-mhlogin b/test/oauth/test-mhlogin index 90bc0df1..682fbc86 100755 --- a/test/oauth/test-mhlogin +++ b/test/oauth/test-mhlogin @@ -18,7 +18,7 @@ expect_no_creds() { test_mhlogin() { start_fakehttp - run_test 'eval echo code | mhlogin -saslmech xoauth2 -authservice test' \ + run_test 'eval echo code | mhlogin -saslmech xoauth2 -authservice test -user nobody@example.com' \ "Load the following URL in your browser and authorize nmh to access test: 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 @@ -52,8 +52,8 @@ fake_json_response < ${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" +#### Strip off the error string because it can vary, e.g., +#### "Failed to connect to 127.0.0.1 port 64546: Connection refused", or +#### "Connection timed out after 1004 milliseconds" +echo code | mhlogin -saslmech xoauth2 -authservice test -user nobody@example.com \ + -browser "echo \$@ > ${MHTMPDIR}/$$.browser" 2>&1 1>/dev/null | \ + sed 's/\( endpoint:\) .*/\1/' > "${MHTMPDIR}/$$.mhlogin.err" +cat > "${MHTMPDIR}/$$.mhlogin.err.expected" < "${MHTMPDIR}/$$.browser.expected" <