Skip to content

Commit

Permalink
test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Duesing committed Feb 13, 2012
1 parent bc43a0b commit dd9f11a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion test/test_imap_xoauth_authenticator.rb
Expand Up @@ -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

Expand Down
14 changes: 8 additions & 6 deletions test/test_oauth_string.rb
Expand Up @@ -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
Expand Down Expand Up @@ -47,28 +48,29 @@ 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')
end

end

require 'gmail_xoauth'

class C
include GmailXoauth::OauthString
end
2 changes: 1 addition & 1 deletion test/test_smtp_xoauth_authenticator.rb
Expand Up @@ -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],
}
Expand Down

0 comments on commit dd9f11a

Please sign in to comment.