Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add the first unit tests (for now just the basic Client interface)

  • Loading branch information...
commit 8e5bdfafa921d7f35e40194f6359a8030b664c4f 1 parent 66fbb6a
Gustavo Machado Campagnani Gama authored
Showing with 48 additions and 0 deletions.
  1. +28 −0 test/unit/client_test.rb
  2. +20 −0 test/unit/mock_client.rb
View
28 test/unit/client_test.rb
@@ -0,0 +1,28 @@
+############################################################
+# Copyright (c) 2010, iGenesis Ltda. #
+# Author: Gustavo Machado C. Gama <gustavo.gama@gmail.com> #
+############################################################
+
+$LOAD_PATH << File.expand_path('../../../lib', __FILE__)
+require 'test/unit'
+require 'mock_client'
+
+class ClientTest < Test::Unit::TestCase
+ def setup
+ @client = MockClient.new
+ end
+
+ def teardown
+ end
+
+ def test_user
+ assert_kind_of Google::Reader::User, @client.user
+ assert_instance_of String, @client.user.given_name
+ assert_match /^\d+$/, @client.user.user_id
+ assert_instance_of Array, @client.user.friends
+ end
+
+ def test_token
+ assert @client.token.is_a?(String)
+ end
+end
View
20 test/unit/mock_client.rb
@@ -0,0 +1,20 @@
+############################################################
+# Copyright (c) 2010, iGenesis Ltda. #
+# Author: Gustavo Machado C. Gama <gustavo.gama@gmail.com> #
+############################################################
+
+require 'oauth'
+require 'google-reader/auth'
+require 'google-reader/client'
+
+class MockClient
+ include Google::Reader::Auth
+ include Google::Reader::Client
+
+ attr :access_token, :request_proxy
+
+ def initialize
+ token, secret = IO.read(File.join(File.expand_path('../../', __FILE__), 'oauth-access-token')).split(/\r?\n/)
+ @access_token = @request_proxy = ::OAuth::AccessToken.new(consumer, token, secret)
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.