From dd9f11aac80eecefb4b13683410733d1c9defe37 Mon Sep 17 00:00:00 2001 From: Chris Duesing Date: Sun, 12 Feb 2012 19:46:45 -0600 Subject: [PATCH] test cleanup --- test/test_imap_xoauth_authenticator.rb | 3 ++- test/test_oauth_string.rb | 14 ++++++++------ test/test_smtp_xoauth_authenticator.rb | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/test/test_imap_xoauth_authenticator.rb b/test/test_imap_xoauth_authenticator.rb index 8951239..2386ebb 100644 --- a/test/test_imap_xoauth_authenticator.rb +++ b/test/test_imap_xoauth_authenticator.rb @@ -48,7 +48,8 @@ def test_2_legged_authenticate_with_invalid_credentials ) end end - + + # this will fail, even with valid credientials, if the account is not set up for 2 step auth def test_2_legged_authenticate_with_valid_credentials return unless VALID_CREDENTIALS diff --git a/test/test_oauth_string.rb b/test/test_oauth_string.rb index bac05ad..cfd1bb5 100644 --- a/test/test_oauth_string.rb +++ b/test/test_oauth_string.rb @@ -3,6 +3,7 @@ class TestOauthString < Test::Unit::TestCase def setup + # @login_params = [VALID_CREDENTIALS[:email], VALID_CREDENTIALS[:consumer_key], VALID_CREDENTIALS[:consumer_secret], VALID_CREDENTIALS[:token], VALID_CREDENTIALS[:token_secret]] end def test_build_oauth_string_should_accept_custom_consumer @@ -47,21 +48,20 @@ def test_build_2_legged_oauth_string_should_accept_custom_consumer OAuth::Helper.stubs(:generate_key).returns('abc') OAuth::Helper.stubs(:generate_timestamp).returns(1274215474) - request_url = "https://mail.google.com/mail/b/user_name@gmail.com/imap/?xoauth_requestor_id=user_name%40gmail.com"; + request_url = "https://mail.google.com/mail/b/user_name@gmail.com/imap/?xoauth_requestor_id=user_name%40gmail.com"; oauth_params = { - :two_legged => true, + :two_legged => true, :consumer_key => 'c', :consumer_secret => 'd', - :xoauth_requestor_id => 'user_name@gmail.com' + :xoauth_requestor_id => 'user_name@gmail.com' } oauth_string = C.new.__send__('build_oauth_string', request_url, oauth_params) - assert_equal( - 'oauth_consumer_key="c",oauth_nonce="abc",oauth_signature="eG6PG7Q%2BPbI%2FNeLLCZ9PvlB%2BUjg%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274215474",oauth_version="1.0"', + assert_equal('oauth_consumer_key="c",oauth_nonce="abc",oauth_signature="eG6PG7Q%2BPbI%2FNeLLCZ9PvlB%2BUjg%3D",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1274215474",oauth_version="1.0"', oauth_string ) - end + end def test_build_sasl_client_request assert_equal 'GET 1 2', C.new.__send__('build_sasl_client_request', '1', '2') @@ -69,6 +69,8 @@ def test_build_sasl_client_request end +require 'gmail_xoauth' + class C include GmailXoauth::OauthString end diff --git a/test/test_smtp_xoauth_authenticator.rb b/test/test_smtp_xoauth_authenticator.rb index 894c96b..1b9544e 100644 --- a/test/test_smtp_xoauth_authenticator.rb +++ b/test/test_smtp_xoauth_authenticator.rb @@ -52,7 +52,7 @@ def test_2_legged_authenticate_with_valid_credentials smtp.enable_starttls_auto secret = { - :two_legged => true, + :two_legged => true, :consumer_key => VALID_CREDENTIALS[:consumer_key], :consumer_secret => VALID_CREDENTIALS[:consumer_secret], }