test/strategy_test.rb in omniauth-facebook-6.0.0 vs test/strategy_test.rb in omniauth-facebook-7.0.0

- old
+ new

@@ -7,15 +7,15 @@ include OAuth2StrategyTests end class ClientTest < StrategyTestCase test 'has correct Facebook site' do - assert_equal 'https://graph.facebook.com/v3.0', strategy.client.site + assert_equal 'https://graph.facebook.com/v4.0', strategy.client.site end test 'has correct authorize url' do - assert_equal 'https://www.facebook.com/v3.0/dialog/oauth', strategy.client.options[:authorize_url] + assert_equal 'https://www.facebook.com/v4.0/dialog/oauth', strategy.client.options[:authorize_url] end test 'has correct token url with versioning' do @options = {client_options: {site: 'https://graph.facebook.net/v2.2'}} assert_equal 'oauth/access_token', strategy.client.options[:token_url] @@ -97,11 +97,11 @@ class InfoTest < StrategyTestCase test 'returns the secure facebook avatar url when `secure_image_url` option is specified' do @options = { secure_image_url: true } raw_info = { 'name' => 'Fred Smith', 'id' => '321' } strategy.stubs(:raw_info).returns(raw_info) - assert_equal 'https://graph.facebook.com/v3.0/321/picture', strategy.info['image'] + assert_equal 'https://graph.facebook.com/v4.0/321/picture', strategy.info['image'] end test 'returns the image_url based of the client site' do @options = { secure_image_url: true, client_options: {site: "https://blah.facebook.com/v2.2"}} raw_info = { 'name' => 'Fred Smith', 'id' => '321' } @@ -111,27 +111,27 @@ test 'returns the image with size specified in the `image_size` option' do @options = { image_size: 'normal' } raw_info = { 'name' => 'Fred Smith', 'id' => '321' } strategy.stubs(:raw_info).returns(raw_info) - assert_equal 'http://graph.facebook.com/v3.0/321/picture?type=normal', strategy.info['image'] + assert_equal 'http://graph.facebook.com/v4.0/321/picture?type=normal', strategy.info['image'] end test 'returns the image with size specified as a symbol in the `image_size` option' do @options = { image_size: :normal } raw_info = { 'name' => 'Fred Smith', 'id' => '321' } strategy.stubs(:raw_info).returns(raw_info) - assert_equal 'http://graph.facebook.com/v3.0/321/picture?type=normal', strategy.info['image'] + assert_equal 'http://graph.facebook.com/v4.0/321/picture?type=normal', strategy.info['image'] end test 'returns the image with width and height specified in the `image_size` option' do @options = { image_size: { width: 123, height: 987 } } raw_info = { 'name' => 'Fred Smith', 'id' => '321' } strategy.stubs(:raw_info).returns(raw_info) assert_match 'width=123', strategy.info['image'] assert_match 'height=987', strategy.info['image'] - assert_match 'http://graph.facebook.com/v3.0/321/picture?', strategy.info['image'] + assert_match 'http://graph.facebook.com/v4.0/321/picture?', strategy.info['image'] end end class InfoTestOptionalDataPresent < StrategyTestCase def setup @@ -174,11 +174,11 @@ assert_equal 'I am great', strategy.info['description'] end test 'returns the facebook avatar url' do @raw_info['id'] = '321' - assert_equal 'http://graph.facebook.com/v3.0/321/picture', strategy.info['image'] + assert_equal 'http://graph.facebook.com/v4.0/321/picture', strategy.info['image'] end test 'returns the Facebook link as the Facebook url' do @raw_info['link'] = 'http://www.facebook.com/fredsmith' assert_kind_of Hash, strategy.info['urls'] @@ -256,36 +256,36 @@ @access_token = stub('OAuth2::AccessToken') @appsecret_proof = 'appsecret_proof' @options = {appsecret_proof: @appsecret_proof, fields: 'name,email'} end - test 'performs a GET to https://graph.facebook.com/v3.0/me' do + test 'performs a GET to https://graph.facebook.com/v4.0/me' do strategy.stubs(:appsecret_proof).returns(@appsecret_proof) strategy.stubs(:access_token).returns(@access_token) params = {params: @options} @access_token.expects(:get).with('me', params).returns(stub_everything('OAuth2::Response')) strategy.raw_info end - test 'performs a GET to https://graph.facebook.com/v3.0/me with locale' do + test 'performs a GET to https://graph.facebook.com/v4.0/me with locale' do @options.merge!({ locale: 'cs_CZ' }) strategy.stubs(:access_token).returns(@access_token) strategy.stubs(:appsecret_proof).returns(@appsecret_proof) params = {params: @options} @access_token.expects(:get).with('me', params).returns(stub_everything('OAuth2::Response')) strategy.raw_info end - test 'performs a GET to https://graph.facebook.com/v3.0/me with info_fields' do + test 'performs a GET to https://graph.facebook.com/v4.0/me with info_fields' do @options.merge!({info_fields: 'about'}) strategy.stubs(:access_token).returns(@access_token) strategy.stubs(:appsecret_proof).returns(@appsecret_proof) params = {params: {appsecret_proof: @appsecret_proof, fields: 'about'}} @access_token.expects(:get).with('me', params).returns(stub_everything('OAuth2::Response')) strategy.raw_info end - test 'performs a GET to https://graph.facebook.com/v3.0/me with default info_fields' do + test 'performs a GET to https://graph.facebook.com/v4.0/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'}} @access_token.expects(:get).with('me', params).returns(stub_everything('OAuth2::Response')) strategy.raw_info