mirror of
https://github.com/simi/omniauth-facebook.git
synced 2022-11-09 12:32:45 -05:00
Add tests when authorization code is not included in callback
This commit is contained in:
parent
a0036b9e5f
commit
c47de0daab
1 changed files with 31 additions and 0 deletions
31
test/test.rb
31
test/test.rb
|
@ -435,4 +435,35 @@ module SignedRequestTests
|
||||||
assert_equal nil, strategy.send(:signed_request_from_cookie)
|
assert_equal nil, strategy.send(:signed_request_from_cookie)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class MissingCodeInParamsRequestTest < TestCase
|
||||||
|
def setup
|
||||||
|
super
|
||||||
|
@request.stubs(:params).returns({})
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'calls fail! when a code is not included in the params' do
|
||||||
|
strategy.expects(:fail!).times(1).with(:no_authorization_code, kind_of(Exception))
|
||||||
|
strategy.callback_phase
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
class MissingCodeInCookieRequestTest < TestCase
|
||||||
|
def setup(algo = nil)
|
||||||
|
super()
|
||||||
|
@payload = {
|
||||||
|
'algorithm' => algo || 'HMAC-SHA256',
|
||||||
|
'code' => nil,
|
||||||
|
'issued_at' => Time.now.to_i,
|
||||||
|
'user_id' => '123456'
|
||||||
|
}
|
||||||
|
|
||||||
|
@request.stubs(:cookies).returns({"fbsr_#{@client_id}" => signed_request(@payload, @client_secret)})
|
||||||
|
end
|
||||||
|
|
||||||
|
test 'calls fail! when a code is not included in the cookie' do
|
||||||
|
strategy.expects(:fail!).times(1).with(:no_authorization_code, kind_of(Exception))
|
||||||
|
strategy.callback_phase
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue