]> diplodocus.org Git - nmh/blobdiff - test/oauth/test-inc
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[nmh] / test / oauth / test-inc
index 8c71e62427b53e946817102186316916823d698e..96a2af04ede8441c83fdacc394ce5a05204e0c3c 100755 (executable)
@@ -17,11 +17,11 @@ setup_pop
 #
 
 # TEST
 #
 
 # TEST
-echo 'access token ready, pop server accepts message'
+start_test 'access token ready, pop server accepts message'
 
 fake_creds <<EOF
 
 fake_creds <<EOF
-access: test-access
-expire: 2000000000
+access-nobody@example.com: test-access
+expire-nobody@example.com: 2000000000
 EOF
 
 start_pop_xoauth
 EOF
 
 start_pop_xoauth
@@ -29,12 +29,12 @@ start_pop_xoauth
 test_inc_success
 
 # TEST
 test_inc_success
 
 # TEST
-echo 'expired access token, refresh works, pop server accepts message'
+start_test 'expired access token, refresh works, pop server accepts message'
 
 fake_creds <<EOF
 
 fake_creds <<EOF
-access: old-access
-refresh: test-refresh
-expire: 1414303986
+access-nobody@example.com: old-access
+refresh-nobody@example.com: test-refresh
+expire-nobody@example.com: 1414303986
 EOF
 
 expect_http_post_refresh
 EOF
 
 expect_http_post_refresh
@@ -47,12 +47,6 @@ fake_json_response <<EOF
 }
 EOF
 
 }
 EOF
 
-expect_creds <<EOF
-access: test-access
-refresh: test-refresh
-expire:
-EOF
-
 start_fakehttp
 start_pop_xoauth
 
 start_fakehttp
 start_pop_xoauth
 
@@ -65,11 +59,11 @@ check_http_req
 #
 
 # TEST
 #
 
 # TEST
-echo 'refresh gets proper error from http'
+start_test 'refresh gets proper error from http'
 
 fake_creds <<EOF
 
 fake_creds <<EOF
-access: test-access
-refresh: test-refresh
+access-nobody@example.com: test-access
+refresh-nobody@example.com: test-refresh
 EOF
 
 expect_http_post_refresh
 EOF
 
 expect_http_post_refresh
@@ -83,6 +77,7 @@ Content-Type: application/json
 EOF
 
 start_fakehttp
 EOF
 
 start_fakehttp
+start_pop_xoauth
 
 test_inc 'inc: error refreshing OAuth2 token
 inc: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
 
 test_inc 'inc: error refreshing OAuth2 token
 inc: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-workers'
@@ -90,27 +85,30 @@ inc: bad OAuth request; re-run with -snoop and send REDACTED output to nmh-worke
 check_http_req
 
 # TEST
 check_http_req
 
 # TEST
-echo 'pop server rejects token'
+start_test 'pop server rejects token'
 
 fake_creds <<EOF
 
 fake_creds <<EOF
-access: wrong-access
-expire: 2000000000
+access-nobody@example.com: wrong-access
+expire-nobody@example.com: 2000000000
 EOF
 
 start_pop_xoauth
 
 EOF
 
 start_pop_xoauth
 
-test_inc 'inc: -ERR [AUTH] Invalid credentials.'
+test_inc 'inc: Authentication failed: -ERR [AUTH] Invalid credentials.'
 
 # TEST
 
 # TEST
-echo "pop server doesn't support oauth"
+start_test "pop server doesn't support oauth"
 
 fake_creds <<EOF
 
 fake_creds <<EOF
-access: test-access
-expire: 2000000000
+access-nobody@example.com: test-access
+expire-nobody@example.com: 2000000000
 EOF
 
 start_pop testuser testpass
 
 test_inc 'inc: POP server does not support SASL'
 
 EOF
 
 start_pop testuser testpass
 
 test_inc 'inc: POP server does not support SASL'
 
+clean_fakehttp
+finish_test
+
 exit ${failed:-0}
 exit ${failed:-0}