Skip to content

Commit

Permalink
Dependency Updates 2024-04-05 (#67)
Browse files Browse the repository at this point in the history
Co-authored-by: Emily Michaud <59289146+emichaud998@users.noreply.github.com>
  • Loading branch information
Jammjammjamm and emichaud998 committed Apr 8, 2024
1 parent c2fe16c commit 6de3e25
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 45 deletions.
16 changes: 8 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ GEM
database_cleaner (~> 1.99.0)
sequel
date_time_precision (0.8.1)
debug (1.9.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
diff-lcs (1.5.1)
Expand Down Expand Up @@ -151,7 +151,7 @@ GEM
i18n (1.14.4)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
inferno_core (0.4.31)
inferno_core (0.4.33)
activesupport (~> 6.1.7.5)
base62-rb (= 0.3.1)
blueprinter (= 0.25.2)
Expand Down Expand Up @@ -204,7 +204,7 @@ GEM
hansi (~> 0.2.0)
mustermann (= 1.1.2)
netrc (0.11.0)
nio4r (2.7.0)
nio4r (2.7.1)
nokogiri (1.16.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-darwin)
Expand All @@ -228,18 +228,18 @@ GEM
pry (>= 0.13, < 0.15)
psych (5.1.2)
stringio
public_suffix (5.0.4)
public_suffix (5.0.5)
puma (5.6.8)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8.1)
rack (2.2.9)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rake (13.1.0)
rdoc (6.6.2)
rake (13.2.1)
rdoc (6.6.3.1)
psych (>= 4.0.0)
redis (4.8.1)
reline (0.4.3)
reline (0.5.0)
io-console (~> 0.5)
rest-client (2.1.0)
http-accept (>= 1.7.0, < 2.0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ class BackendServicesAuthorizationRequestSuccessTest < Inferno::Test
input :client_auth_encryption_method,
:backend_services_requested_scope,
:backend_services_client_id,
:smart_token_url,
:backend_services_jwks_kid
:smart_token_url
input :backend_services_jwks_kid,
optional: true

output :authentication_response

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class BackendServicesInvalidClientAssertionTest < Inferno::Test
input :client_auth_encryption_method,
:backend_services_requested_scope,
:backend_services_client_id,
:smart_token_url,
:backend_services_jwks_kid
:smart_token_url
input :backend_services_jwks_kid,
optional: true

http_client :token_endpoint do
url :smart_token_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class BackendServicesInvalidGrantTypeTest < Inferno::Test
input :client_auth_encryption_method,
:backend_services_requested_scope,
:backend_services_client_id,
:smart_token_url,
:backend_services_jwks_kid
:smart_token_url
input :backend_services_jwks_kid,
optional: true

http_client :token_endpoint do
url :smart_token_url
Expand Down
5 changes: 3 additions & 2 deletions lib/smart_app_launch/backend_services_invalid_jwt_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ class BackendServicesInvalidJWTTest < Inferno::Test
input :client_auth_encryption_method,
:backend_services_requested_scope,
:backend_services_client_id,
:smart_token_url,
:backend_services_jwks_kid
:smart_token_url
input :backend_services_jwks_kid,
optional: true

http_client :token_endpoint do
url :smart_token_url
Expand Down
13 changes: 9 additions & 4 deletions spec/smart_app_launch/app_redirect_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
client_id: 'CLIENT_ID',
requested_scopes: 'REQUESTED_SCOPES',
url: url,
smart_authorization_url: 'http://example.com/auth'
smart_authorization_url: 'http://example.com/auth',
use_pkce: 'false'
}
end

Expand Down Expand Up @@ -60,7 +61,8 @@ def run(runnable, inputs = {})
end

it 'fails if the authorization url is invalid' do
result = run(test, smart_authorization_url: 'xyz')
inputs[:smart_authorization_url] = 'xyz'
result = run(test, inputs)
expect(result.result).to eq('fail')
expect(result.result_message).to match(/is not a valid URI/)
end
Expand All @@ -87,11 +89,14 @@ def run(runnable, inputs = {})
end

context 'when PKCE is enabled' do
let(:pkce_inputs) { inputs.merge(use_pkce: 'true', pkce_code_challenge_method: 'S256') }
let(:pkce_inputs) do
pkce_inputs = inputs.merge(pkce_code_challenge_method: 'S256')
pkce_inputs[:use_pkce] = true
pkce_inputs
end

it 'adds code_challenge and code_challenge method to the authorization url' do
result = run(test, pkce_inputs)

expect(result.result).to eq('wait')
expect(result.result_message).to match(/code_challenge=[a-zA-Z0-9\-_]+/)
expect(result.result_message).to match(/code_challenge_method=S256/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let(:client_auth_encryption_method) { 'ES384' }
let(:backend_services_requested_scope) { 'system/Patient.read' }
let(:backend_services_client_id) { 'clientID' }
let(:backend_services_jwks_kid) { nil }
let(:exp) { 5.minutes.from_now }
let(:jti) { SecureRandom.hex(32) }
let(:request_builder) { BackendServicesAuthorizationRequestBuilder.new(builder_input) }
Expand All @@ -21,8 +20,7 @@
smart_token_url:,
client_auth_encryption_method:,
backend_services_requested_scope:,
backend_services_client_id:,
backend_services_jwks_kid:
backend_services_client_id:
}
end
let(:builder_input) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def run(runnable, inputs = {})
result = run(test)

expect(result.result).to eq('skip')
expect(result.result_message).to eq('No authentication response received.')
expect(result.result_message).to eq("Input 'authentication_response' is nil, skipping test.")
end

it 'fails when authentication response is invalid JSON' do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let(:client_auth_encryption_method) { 'ES384' }
let(:backend_services_requested_scope) { 'system/Patient.read' }
let(:backend_services_client_id) { 'clientID' }
let(:backend_services_jwks_kid) { nil }
let(:exp) { 5.minutes.from_now }
let(:jti) { SecureRandom.hex(32) }
let(:request_builder) { BackendServicesAuthorizationRequestBuilder.new(builder_input) }
Expand All @@ -21,8 +20,7 @@
smart_token_url:,
client_auth_encryption_method:,
backend_services_requested_scope:,
backend_services_client_id:,
backend_services_jwks_kid:
backend_services_client_id:
}
end
let(:builder_input) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let(:client_auth_encryption_method) { 'ES384' }
let(:backend_services_requested_scope) { 'system/Patient.read' }
let(:backend_services_client_id) { 'clientID' }
let(:backend_services_jwks_kid) { nil }
let(:exp) { 5.minutes.from_now }
let(:jti) { SecureRandom.hex(32) }
let(:request_builder) { BackendServicesAuthorizationRequestBuilder.new(builder_input) }
Expand All @@ -21,8 +20,7 @@
smart_token_url:,
client_auth_encryption_method:,
backend_services_requested_scope:,
backend_services_client_id:,
backend_services_jwks_kid:
backend_services_client_id:
}
end
let(:builder_input) do
Expand Down Expand Up @@ -69,7 +67,6 @@ def run(runnable, inputs = {})
.to_return(status: 400)

result = run(test, input)

expect(result.result).to eq('pass')
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
let(:client_auth_encryption_method) { 'ES384' }
let(:backend_services_requested_scope) { 'system/Patient.read' }
let(:backend_services_client_id) { 'clientID' }
let(:backend_services_jwks_kid) { nil }
let(:exp) { 5.minutes.from_now }
let(:jti) { SecureRandom.hex(32) }
let(:request_builder) { BackendServicesAuthorizationRequestBuilder.new(builder_input) }
Expand All @@ -21,8 +20,7 @@
smart_token_url:,
client_auth_encryption_method:,
backend_services_requested_scope:,
backend_services_client_id:,
backend_services_jwks_kid:
backend_services_client_id:
}
end
let(:builder_input) do
Expand Down
8 changes: 5 additions & 3 deletions spec/smart_app_launch/ehr_launch_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
smart_token_url: token_url,
client_id: 'CLIENT_ID',
requested_scopes: 'launch/patient patient/*.*',
client_auth_type: 'public'
client_auth_type: 'public',
use_pkce: 'false'
}
end
let(:token_response) do
Expand All @@ -47,11 +48,13 @@ def run(runnable, inputs = {})
test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash)
test_run = Inferno::Repositories::TestRuns.new.create(test_run_params)
inputs.each do |name, value|
type = runnable.config.input_type(name).presence || 'text'
type = 'text' if type == 'radio'
session_data_repo.save(
test_session_id: test_session.id,
name: runnable.config.input_name(name).presence || name,
value: value,
type: runnable.config.input_type(name).presence || 'text'
type: type
)
end
Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable)
Expand All @@ -78,7 +81,6 @@ def run(runnable, inputs = {})
get "/custom/smart/redirect?state=#{state}&code=CODE"

results = results_repo.current_results_for_test_session(test_session.id)

expect(results.map(&:result)).to all(eq('pass'))

expected_outputs = {
Expand Down
7 changes: 5 additions & 2 deletions spec/smart_app_launch/standalone_launch_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
smart_token_url: token_url,
client_id: 'CLIENT_ID',
requested_scopes: 'launch/patient patient/*.*',
client_auth_type: 'public'
client_auth_type: 'public',
use_pkce: 'false'
}
end
let(:token_response) do
Expand All @@ -47,11 +48,13 @@ def run(runnable, inputs = {})
test_run_params = { test_session_id: test_session.id }.merge(runnable.reference_hash)
test_run = Inferno::Repositories::TestRuns.new.create(test_run_params)
inputs.each do |name, value|
type = runnable.config.input_type(name).presence || 'text'
type = 'text' if type == 'radio'
session_data_repo.save(
test_session_id: test_session.id,
name: runnable.config.input_name(name).presence || name,
value: value,
type: runnable.config.input_type(name).presence || 'text'
type: type
)
end
Inferno::TestRunner.new(test_session: test_session, test_run: test_run).run(runnable)
Expand Down
3 changes: 2 additions & 1 deletion spec/smart_app_launch/token_exchange_stu2_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
smart_token_url: token_url,
client_id:,
client_auth_type: 'confidential_asymmetric',
client_auth_encryption_method:
client_auth_encryption_method:,
use_pkce: 'false'
}
end

Expand Down
3 changes: 2 additions & 1 deletion spec/smart_app_launch/token_exchange_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
{
code: 'CODE',
smart_token_url: token_url,
client_id: 'CLIENT_ID'
client_id: 'CLIENT_ID',
use_pkce: 'false'
}
end
let(:confidential_inputs) do
Expand Down
7 changes: 3 additions & 4 deletions spec/smart_app_launch/token_response_body_test_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def create_token_request(body: nil, status: 200, headers: nil)
it 'skips if the token request was not successful' do
create_token_request(body: { access_token: 'ACCESS_TOKEN', token_type: 'bearer' }, status: 500)

result = run(test)
result = run(test, requested_scopes: 'patient/*.*')

expect(result.result).to eq('skip')
expect(result.result_message).to match(/was unsuccessful/)
Expand All @@ -76,8 +76,7 @@ def create_token_request(body: nil, status: 200, headers: nil)
it 'fails if the body is not valid json' do
create_token_request(body: '[[')

result = run(test)

result = run(test, requested_scopes: 'patient/*.*')
expect(result.result).to eq('fail')
expect(result.result_message).to match(/Invalid JSON/)
end
Expand All @@ -87,7 +86,7 @@ def create_token_request(body: nil, status: 200, headers: nil)
bad_body = valid_body.reject { |key, _| key == field }
create_token_request(body: bad_body)

result = run(test)
result = run(test, requested_scopes: 'patient/*.*')

expect(result.result).to eq('fail')
expect(result.result_message).to match(/`#{field}`/)
Expand Down

0 comments on commit 6de3e25

Please sign in to comment.