Skip to content

Commit

Permalink
Integrate SMART v2.2 into US Core Test Kit
Browse files Browse the repository at this point in the history
  • Loading branch information
emichaud998 committed Oct 28, 2024
1 parent 4d20c62 commit 30e72dd
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 14 deletions.
34 changes: 28 additions & 6 deletions lib/us_core_test_kit/custom_groups/smart_app_launch_group.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
require 'smart_app_launch_test_kit'
require_relative '../us_core_options'
require_relative './smart_ehr_launch_stu1'
require_relative './smart_ehr_launch_stu2'
require_relative './smart_standalone_launch_stu1_group'
require_relative './smart_standalone_launch_stu2_group'
require_relative 'smart_ehr_launch_stu1'
require_relative 'smart_ehr_launch_stu2'
require_relative 'smart_ehr_launch_stu2_2'
require_relative 'smart_standalone_launch_stu1_group'
require_relative 'smart_standalone_launch_stu2_group'
require_relative 'smart_standalone_launch_stu2_2_group'

module USCoreTestKit
class SmartAppLaunchGroup < Inferno::TestGroup
id :us_core_smart_app_launch
title 'SMART App Launch'

SMART_V1_RESOURCE_LEVEL_SCOPES = "launch/patient openid fhirUser offline_access patient/Medication.read patient/AllergyIntolerance.read patient/CarePlan.read patient/CareTeam.read patient/Condition.read patient/Device.read patient/DiagnosticReport.read patient/DocumentReference.read patient/Encounter.read patient/Goal.read patient/Immunization.read patient/Location.read patient/MedicationRequest.read patient/Observation.read patient/Organization.read patient/Patient.read patient/Practitioner.read patient/Procedure.read patient/Provenance.read patient/PractitionerRole.read patient/ServiceRequest.read patient/RelatedPerson.read patient/Specimen.read patient/MedicationDispense.read patient/Coverage.read patient/Location.read patient/media.read".freeze
SMART_V1_RESOURCE_LEVEL_SCOPES = 'launch/patient openid fhirUser offline_access patient/Medication.read patient/AllergyIntolerance.read patient/CarePlan.read patient/CareTeam.read patient/Condition.read patient/Device.read patient/DiagnosticReport.read patient/DocumentReference.read patient/Encounter.read patient/Goal.read patient/Immunization.read patient/Location.read patient/MedicationRequest.read patient/Observation.read patient/Organization.read patient/Patient.read patient/Practitioner.read patient/Procedure.read patient/Provenance.read patient/PractitionerRole.read patient/ServiceRequest.read patient/RelatedPerson.read patient/Specimen.read patient/MedicationDispense.read patient/Coverage.read patient/Location.read patient/media.read'.freeze

SMART_V2_RESOURCE_LEVEL_SCOPES = "launch/patient openid fhirUser offline_access patient/Medication.rs patient/AllergyIntolerance.rs patient/CarePlan.rs patient/CareTeam.rs patient/Condition.rs patient/Device.rs patient/DiagnosticReport.rs patient/DocumentReference.rs patient/Encounter.rs patient/Goal.rs patient/Immunization.rs patient/Location.rs patient/MedicationRequest.rs patient/Observation.rs patient/Organization.rs patient/Patient.rs patient/Practitioner.rs patient/Procedure.rs patient/Provenance.rs patient/PractitionerRole.rs patient/ServiceRequest.rs patient/RelatedPerson.rs patient/Specimen.rs patient/MedicationDispense.rs patient/Coverage.rs patient/Location.rs patient/Media.rs".freeze
SMART_V2_RESOURCE_LEVEL_SCOPES = 'launch/patient openid fhirUser offline_access patient/Medication.rs patient/AllergyIntolerance.rs patient/CarePlan.rs patient/CareTeam.rs patient/Condition.rs patient/Device.rs patient/DiagnosticReport.rs patient/DocumentReference.rs patient/Encounter.rs patient/Goal.rs patient/Immunization.rs patient/Location.rs patient/MedicationRequest.rs patient/Observation.rs patient/Organization.rs patient/Patient.rs patient/Practitioner.rs patient/Procedure.rs patient/Provenance.rs patient/PractitionerRole.rs patient/ServiceRequest.rs patient/RelatedPerson.rs patient/Specimen.rs patient/MedicationDispense.rs patient/Coverage.rs patient/Location.rs patient/Media.rs'.freeze

SMART_V2_2_RESOURCE_LEVEL_SCOPES = 'launch/patient openid fhirUser offline_access patient/Medication.rs patient/AllergyIntolerance.rs patient/CarePlan.rs patient/CareTeam.rs patient/Condition.rs patient/Device.rs patient/DiagnosticReport.rs patient/DocumentReference.rs patient/Encounter.rs patient/Goal.rs patient/Immunization.rs patient/Location.rs patient/MedicationRequest.rs patient/Observation.rs patient/Organization.rs patient/Patient.rs patient/Practitioner.rs patient/Procedure.rs patient/Provenance.rs patient/PractitionerRole.rs patient/ServiceRequest.rs patient/RelatedPerson.rs patient/Specimen.rs patient/MedicationDispense.rs patient/Coverage.rs patient/Location.rs patient/Media.rs'.freeze

group from: :us_core_smart_standalone_launch_stu1,
required_suite_options: USCoreOptions::SMART_1_REQUIREMENT,
Expand Down Expand Up @@ -49,5 +53,23 @@ class SmartAppLaunchGroup < Inferno::TestGroup
requested_scopes: { default: SmartAppLaunchGroup::SMART_V2_RESOURCE_LEVEL_SCOPES }
}
}

group from: :us_core_smart_standalone_launch_stu2_2,
required_suite_options: USCoreOptions::SMART_2_2_REQUIREMENT,
optional: true,
config: {
inputs: {
requested_scopes: { default: SmartAppLaunchGroup::SMART_V2_2_RESOURCE_LEVEL_SCOPES }
}
}

group from: :us_core_smart_ehr_launch_stu2_2,
required_suite_options: USCoreOptions::SMART_2_2_REQUIREMENT,
optional: true,
config: {
inputs: {
requested_scopes: { default: SmartAppLaunchGroup::SMART_V2_2_RESOURCE_LEVEL_SCOPES }
}
}
end
end
40 changes: 40 additions & 0 deletions lib/us_core_test_kit/custom_groups/smart_ehr_launch_stu2_2.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module USCoreTestKit
class SmartEHRLaunchSTU22 < Inferno::TestGroup
id :us_core_smart_ehr_launch_stu2_2
title 'EHR Launch'

run_as_group

group from: :smart_discovery_stu2_2,
run_as_group: true
group from: :smart_ehr_launch_stu2_2,
run_as_group: true

group from: :smart_openid_connect_stu2_2 do
run_as_group
optional
config(
inputs: {
id_token: { name: :ehr_id_token },
client_id: { name: :ehr_client_id },
requested_scopes: { name: :ehr_requested_scopes },
access_token: { name: :ehr_access_token },
smart_credentials: { name: :ehr_smart_credentials }
}
)
end

group from: :smart_token_refresh_stu2 do
run_as_group
optional
config(
inputs: {
refresh_token: { name: :ehr_refresh_token },
client_id: { name: :ehr_client_id },
client_secret: { name: :ehr_client_secret },
received_scopes: { name: :ehr_received_scopes }
}
)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module USCoreTestKit
class SmartStandaloneLaunchSTU22 < Inferno::TestGroup
id :us_core_smart_standalone_launch_stu2_2
title 'Standalone Launch'

run_as_group

group from: :smart_discovery_stu2_2,
run_as_group: true
group from: :smart_standalone_launch_stu2_2,
run_as_group: true

group from: :smart_openid_connect_stu2_2 do
run_as_group
optional
config(
inputs: {
id_token: { name: :standalone_id_token },
client_id: { name: :standalone_client_id },
requested_scopes: { name: :standalone_requested_scopes },
access_token: { name: :standalone_access_token },
smart_credentials: { name: :standalone_smart_credentials }
}
)
end

group from: :smart_token_refresh_stu2 do
run_as_group
optional
config(
inputs: {
refresh_token: { name: :standalone_refresh_token },
client_id: { name: :standalone_client_id },
client_secret: { name: :standalone_client_secret },
received_scopes: { name: :standalone_received_scopes }
}
)
end
end
end
4 changes: 4 additions & 0 deletions lib/us_core_test_kit/generated/v3.1.1/us_core_test_suite.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/us_core_test_kit/generated/v4.0.0/us_core_test_suite.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions lib/us_core_test_kit/generated/v5.0.1/us_core_test_suite.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/us_core_test_kit/generated/v6.1.0/us_core_test_suite.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/us_core_test_kit/generated/v7.0.0/us_core_test_suite.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions lib/us_core_test_kit/generator/templates/suite.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ module USCoreTestKit
{
label: 'SMART App Launch 2.0.0',
value: USCoreOptions::SMART_2
},
{
label: 'SMART App Launch 2.2.0',
value: USCoreOptions::SMART_2_2
}
]

Expand Down Expand Up @@ -123,6 +127,9 @@ module USCoreTestKit

group from: :<%= granular_scopes_id %>,
required_suite_options: USCoreOptions::SMART_2_REQUIREMENT
group from: :<%= granular_scopes_id %>,
id: :<%= granular_scopes_id %>_stu2_2,
required_suite_options: USCoreOptions::SMART_2_2_REQUIREMENT
<% end %>
end
end
Expand Down
17 changes: 9 additions & 8 deletions lib/us_core_test_kit/us_core_options.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
module USCoreTestKit
module USCoreOptions
SMART_1 = 'smart_app_launch_1'.freeze
SMART_2 = 'smart_app_launch_2'.freeze

SMART_1_REQUIREMENT = { smart_app_launch_version: SMART_1 }.freeze
SMART_2_REQUIREMENT = { smart_app_launch_version: SMART_2 }.freeze
end
module USCoreOptions
SMART_1 = 'smart_app_launch_1'.freeze
SMART_2 = 'smart_app_launch_2'.freeze
SMART_2_2 = 'smart_app_launch_2_2'.freeze

SMART_1_REQUIREMENT = { smart_app_launch_version: SMART_1 }.freeze
SMART_2_REQUIREMENT = { smart_app_launch_version: SMART_2 }.freeze
SMART_2_2_REQUIREMENT = { smart_app_launch_version: SMART_2_2 }.freeze
end
end

0 comments on commit 30e72dd

Please sign in to comment.