test_mhlogin() {
start_fakehttp
- run_test 'eval echo code | mhlogin -oauth test' \
+ run_test 'eval echo code | mhlogin -saslmech xoauth2 -authservice test' \
"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
#
# TEST
-echo 'mhlogin receives access and expiration'
+start_test 'mhlogin receives access and expiration'
expect_http_post_code
test_mhlogin
# TEST
-echo 'mhlogin receives access and refresh'
+start_test 'mhlogin receives access and refresh'
expect_http_post_code
test_mhlogin
# TEST
-echo 'mhlogin receives access, expiration, and refresh'
+start_test 'mhlogin receives access, expiration, and refresh'
expect_http_post_code
test_mhlogin
# TEST
-echo 'mhlogin receives refresh only'
+start_test 'mhlogin receives refresh only'
expect_http_post_code
test_mhlogin
# TEST
-echo 'mhlogin receives token_type only'
+start_test 'mhlogin receives token_type only'
expect_http_post_code
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin ignores extra bits in successful response JSON'
+start_test 'mhlogin ignores extra bits in successful response JSON'
expect_http_post_code
test_mhlogin
# TEST
-echo 'mhlogin user enters bad code'
+start_test 'mhlogin user enters bad code'
expect_http_post_code
#
# TEST
-echo 'mhlogin response has no content-type'
+start_test 'mhlogin response has no content-type'
expect_http_post_code
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin JSON array'
+start_test 'mhlogin JSON array'
expect_http_post_code
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin JSON empty object'
+start_test 'mhlogin JSON empty object'
expect_http_post_code
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin empty response body'
+start_test 'mhlogin empty response body'
expect_http_post_code
test_mhlogin_invalid_response
# TEST
-echo 'mhlogin gets proper error from http'
+start_test 'mhlogin gets proper error from http'
expect_http_post_code
mhlogin: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
clean_fakehttp
+finish_test
exit ${failed:-0}