Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
v0.8.2 release.
Browse files Browse the repository at this point in the history
  • Loading branch information
hhorikawa committed Jun 3, 2020
1 parent 4263e9b commit ca40f72
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
16 changes: 10 additions & 6 deletions test/lib/omniauth/strategies/openid_connect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,20 @@ def test_request_phase_via_http
def test_option_acr_values
strategy.options.client_options[:host] = 'foobar.com'

refute_match /acr_values=/, strategy.authorize_uri, 'URI must not contain acr_values' #/
refute_includes strategy.authorize_params.keys, :acr_values,
'URI must not contain acr_values' #/

strategy.options.acr_values = 'urn:some:acr:values:value'
assert_match /acr_values=/, strategy.authorize_uri, 'URI must contain acr_values'
assert_includes strategy.authorize_params.keys, :acr_values,
'URI must contain acr_values'
end


def test_option_custom_attributes
strategy.options.client_options[:host] = 'foobar.com'
strategy.options.extra_authorize_params = {resource: 'xyz'}
assert_match /resource=xyz/, strategy.authorize_uri, 'URI must contain custom params'
assert_match 'xyz', strategy.authorize_params[:resource],
'URI must contain custom params'
end


Expand Down Expand Up @@ -428,11 +432,10 @@ def test_callback_phase_with_invalid_state

strategy.call!('rack.session' => { 'omniauth.state' => state,
'omniauth.nonce' => nonce })
strategy.expects(:fail!)
result = strategy.callback_phase
assert_kind_of Array, result
assert_equal 302, result.first, 'Expecting redirect to /callback/failure'

strategy.expects(:fail!)
end

def test_callback_phase_without_code
Expand Down Expand Up @@ -687,7 +690,8 @@ def test_state
def test_dynamic_state
# Stub request parameters
request.stubs(:path_info).returns('')
strategy.call!('rack.session' => { }, QUERY_STRING: { state: 'abc', client_id: '123' } )
strategy.call!('rack.session' => { },
Rack::QUERY_STRING => { state: 'abc', client_id: '123' } )

assert_kind_of Array, result
assert_equal 302, result.first, 'Expecting redirect to /auth/failure'
Expand Down
11 changes: 6 additions & 5 deletions test/strategy_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ def user_info

def request
# stub Rack::Request
@request ||= Rack::Request.new({}).tap do |request|
request.stubs(:params).returns({})
request.stubs(:cookies).returns({})
@request ||= Rack::Request.new({
'rack.input' => '',
'rack.url_scheme' => 'http'})
#request.stubs(:params).returns({})
#request.stubs(:cookies).returns({})
#request.stubs(:env).returns({}) set by ctor
request.stubs(:scheme).returns('http')
#request.stubs(:scheme).returns('http')
#request.stubs(:ssl?).returns(false)
end
end

def strategy
Expand Down

0 comments on commit ca40f72

Please sign in to comment.