|
|
|
@ -9,11 +9,11 @@ end
|
|
|
|
|
|
|
|
|
|
class ClientTest < StrategyTestCase
|
|
|
|
|
test 'has correct Facebook site' do
|
|
|
|
|
assert_equal 'https://graph.facebook.com/v4.0', strategy.client.site
|
|
|
|
|
assert_equal "https://graph.facebook.com/#{@facebook_api_version}", strategy.client.site
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'has correct authorize url' do
|
|
|
|
|
assert_equal 'https://www.facebook.com/v4.0/dialog/oauth', strategy.client.options[:authorize_url]
|
|
|
|
|
assert_equal "https://www.facebook.com/#{@facebook_api_version}/dialog/oauth", strategy.client.options[:authorize_url]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'has correct token url with versioning' do
|
|
|
|
@ -106,7 +106,7 @@ class InfoTest < StrategyTestCase
|
|
|
|
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
|
|
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
assert_equal 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
|
|
|
|
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'returns the non-ssl facebook avatar url when `secure_image_url` option is set to false' do
|
|
|
|
@ -114,14 +114,14 @@ class InfoTest < StrategyTestCase
|
|
|
|
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
|
|
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
assert_equal 'http://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
|
|
|
|
assert_equal "http://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'returns the secure facebook avatar url when `secure_image_url` option is omitted' do
|
|
|
|
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
|
|
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
assert_equal 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
|
|
|
|
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'returns the image_url based of the client site' do
|
|
|
|
@ -137,7 +137,7 @@ class InfoTest < StrategyTestCase
|
|
|
|
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
|
|
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
assert_equal 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token&type=normal', strategy.info['image']
|
|
|
|
|
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'returns the image with size specified as a symbol in the `image_size` option' do
|
|
|
|
@ -145,7 +145,7 @@ class InfoTest < StrategyTestCase
|
|
|
|
|
raw_info = { 'name' => 'Fred Smith', 'id' => '321' }
|
|
|
|
|
strategy.stubs(:raw_info).returns(raw_info)
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
assert_equal 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token&type=normal', strategy.info['image']
|
|
|
|
|
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token&type=normal", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'returns the image with width and height specified in the `image_size` option' do
|
|
|
|
@ -155,7 +155,7 @@ class InfoTest < StrategyTestCase
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
assert_match 'width=123', strategy.info['image']
|
|
|
|
|
assert_match 'height=987', strategy.info['image']
|
|
|
|
|
assert_match 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
|
|
|
|
assert_match "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -206,7 +206,7 @@ class InfoTestOptionalDataPresent < StrategyTestCase
|
|
|
|
|
|
|
|
|
|
test 'returns the facebook avatar url' do
|
|
|
|
|
@raw_info['id'] = '321'
|
|
|
|
|
assert_equal 'https://graph.facebook.com/v4.0/321/picture?access_token=test_access_token', strategy.info['image']
|
|
|
|
|
assert_equal "https://graph.facebook.com/#{@facebook_api_version}/321/picture?access_token=test_access_token", strategy.info['image']
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'returns the Facebook link as the Facebook url' do
|
|
|
|
@ -292,7 +292,7 @@ class RawInfoTest < StrategyTestCase
|
|
|
|
|
@options = {appsecret_proof: @appsecret_proof, fields: 'name,email'}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'performs a GET to https://graph.facebook.com/v4.0/me' do
|
|
|
|
|
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me" do
|
|
|
|
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
params = {params: @options}
|
|
|
|
@ -300,7 +300,7 @@ class RawInfoTest < StrategyTestCase
|
|
|
|
|
strategy.raw_info
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'performs a GET to https://graph.facebook.com/v4.0/me with locale' do
|
|
|
|
|
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with locale" do
|
|
|
|
|
@options.merge!({ locale: 'cs_CZ' })
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
|
|
@ -309,7 +309,7 @@ class RawInfoTest < StrategyTestCase
|
|
|
|
|
strategy.raw_info
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'performs a GET to https://graph.facebook.com/v4.0/me with info_fields' do
|
|
|
|
|
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with info_fields" do
|
|
|
|
|
@options.merge!({info_fields: 'about'})
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
|
|
@ -318,7 +318,7 @@ class RawInfoTest < StrategyTestCase
|
|
|
|
|
strategy.raw_info
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test 'performs a GET to https://graph.facebook.com/v4.0/me with default info_fields' do
|
|
|
|
|
test "performs a GET to https://graph.facebook.com/#{@facebook_api_version}/me with default info_fields" do
|
|
|
|
|
strategy.stubs(:access_token).returns(@access_token)
|
|
|
|
|
strategy.stubs(:appsecret_proof).returns(@appsecret_proof)
|
|
|
|
|
params = {params: {appsecret_proof: @appsecret_proof, fields: 'name,email'}}
|
|
|
|
|