]> diplodocus.org Git - nmh/commitdiff
Change the tests to make them work with the new program output
authorKen Hornstein <kenh@pobox.com>
Thu, 22 Sep 2016 23:12:36 +0000 (19:12 -0400)
committerKen Hornstein <kenh@pobox.com>
Thu, 22 Sep 2016 23:12:36 +0000 (19:12 -0400)
and slight change in the interface.

test/oauth/common.sh
test/oauth/test-send
test/oauth/test-sendfrom
test/oauth/test-share
test/send/test-sendfrom

index 932c705144e26e94bf1eacf50e39ab4998ec20f7..d2ac2a27156610681e992447f21ee8f953f49ee3 100644 (file)
@@ -142,7 +142,7 @@ test_inc_success() {
 }
 
 test_send_no_servers() {
-    run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice test -user nobody@example.com" "$@"
+    run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com" "$@"
 }
 
 test_send_only_fakesmtp() {
index 98efb2b59c756adbd7f4890db44d33568406d1d6..dc10080ae3122f5969e1bc011e0022c6f7fcf49b 100755 (executable)
@@ -35,7 +35,7 @@ expire-nobody@example.com: 2000000000
 EOF
 
 start_fakesmtp
-run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice test -user nobody@example.com"
+run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com"
 
 # TEST
 start_test 'expired access token, refresh works, smtp server accepts message'
@@ -163,7 +163,7 @@ setup_draft
 # TEST
 start_test 'no service definition'
 
-run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -saslmech xoauth2 -authservice bogus -user nobody@example.com" 'send: Unable to retrieve oauth profile entries: scope is missing'
+run_test "send -draft -server 127.0.0.1 -port ${smtp_port} -sasl -saslmech xoauth2 -authservice bogus -user nobody@example.com" 'send: Unable to retrieve oauth profile entries: scope is missing'
 
 # TEST
 start_test 'no creds file -- should tell user to mhlogin'
@@ -269,7 +269,7 @@ EOF
 
 start_fakesmtp
 run_prog send -draft -server 127.0.0.1 -port ${smtp_port} \
-  -saslmech xoauth2 -authservice test -user nobody@example.com > "${testname}.send-output" 2>&1 || true
+  -sasl -saslmech xoauth2 -authservice test -user nobody@example.com > "${testname}.send-output" 2>&1 || true
 # Clear out an error message we get from libcurl on some systems (seen at least
 # 3 different versions of this error message, on FreeBSD 10.1, Ubuntu 12.04, and
 # Ubuntu 14.04).
@@ -358,7 +358,7 @@ access-nobody@example.com: test-access
 expire-nobody@example.com: 2000000000
 EOF
 
-test_send_only_fakesmtp 'post: problem initializing server; [BHST] Not no way, not no how!
+test_send_only_fakesmtp 'post: problem initializing server; [BHST] Authentication failed: Not no way, not no how!
 send: message not delivered to anyone'
 
 # TEST
@@ -385,7 +385,7 @@ start_test "smtp server doesn't support oauth"
 
 unset XOAUTH
 
-test_send_only_fakesmtp 'post: problem initializing server; [BHST] SMTP server does not support SASL XOAUTH2
+test_send_only_fakesmtp 'post: problem initializing server; [BHST] SMTP server does not support SASL
 send: message not delivered to anyone'
 
 clean_fakesmtp
index 4ed020b0076c62426153d3b5bbb72c47dfe160e3..3c68a0fa355183d7af1a8c252ed8c0dd68d9c9cd 100755 (executable)
@@ -30,7 +30,7 @@ EOF
 sendfrom="$MH_INST_DIR${datarootdir}/doc/nmh/contrib/sendfrom"
 cat >> "$MH" <<EOF
 sendfrom-nobody@example.com: -server 127.0.0.1 -port ${smtp_port}
-  -client localhost -saslmech xoauth2 -authservice test -user user@example.com
+  -client localhost -sasl -saslmech xoauth2 -authservice test -user user@example.com
 EOF
 
 cat > "${testname}.expected" <<EOF
index ab89a3ff34b4980e94b1cc0e9eee8fc3a5fa6bef..10aa913ab3e9d593e9b01c1f7c6998b17c1ffb5f 100755 (executable)
@@ -42,7 +42,7 @@ http://127.0.0.1:${http_port}/oauth/auth?response_type=code&client_id=test-id&re
 Enter the authorization code: "
 
 start_pop_xoauth
-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'
+run_test "msgchk -host 127.0.0.1 -port ${pop_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
 
 start_pop_xoauth
 test_inc_success
@@ -74,7 +74,7 @@ start_pop_xoauth
 test_inc_success
 
 start_pop_xoauth
-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'
+run_test "msgchk -host 127.0.0.1 -port ${pop_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
 
 setup_draft
 test_send_only_fakesmtp
@@ -100,7 +100,7 @@ EOF
 
 start_fakehttp
 start_pop_xoauth
-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'
+run_test "msgchk -host 127.0.0.1 -port ${pop_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
 
 start_pop_xoauth
 test_inc_success
@@ -131,7 +131,7 @@ setup_draft
 test_send
 
 start_pop_xoauth
-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'
+run_test "msgchk -host 127.0.0.1 -port ${pop_port} -sasl -saslmech xoauth2 -authservice test -user nobody@example.com" 'nobody@example.com has 1 message (178 bytes) on 127.0.0.1'
 
 start_pop_xoauth
 test_inc_success
index 68ddb276f1117e588cfaa267e06d4fcee6476715..7333d1bdc3df9428a917ff9609cfbcd9075c2ba6 100755 (executable)
@@ -51,9 +51,12 @@ QUIT
 EOF
 
 cat > "${testname}.post-expected" <<EOF
+Trying to connect to "127.0.0.1" ...
+Connecting to 127.0.0.1:${localport}...
 <= 220 Not really an ESMTP server
 => EHLO nosuchhost.example.com
-<= 250 I'll buy that for a dollar!
+<= 250-ready
+<= 250 AUTH XOAUTH2
 => MAIL FROM:<nobody@example.com>
 <= 250 I'll buy that for a dollar!
 => RCPT TO:<somebody@example.com>
@@ -67,7 +70,7 @@ cat > "${testname}.post-expected" <<EOF
 EOF
 
 test_post "${testname}.actual" "${testname}.expected" \
-    > ${testname}.post 2>/dev/null
+    2> ${testname}.post
 
 check "${testname}.post-expected" "${testname}.post"