diff --git a/.env b/.env index 0d30fdc4..1a9cd7b2 100644 --- a/.env +++ b/.env @@ -3,7 +3,7 @@ G10_VALIDATOR_URL=http://validator_service:4567 G10_FHIR_RESOURCE_VALIDATOR_URL=http://hl7_validator_service:3500 REDIS_URL=redis://redis:6379/0 -USE_HL7_RESOURCE_VALIDATOR=false +USE_HL7_RESOURCE_VALIDATOR=true # To use the HL7 validator wrapper instead of the inferno validator wrapper, set the above to true, # and uncomment the relevant settings in the following files: # - docker-compose.yml -- "hl7_validator_service" section at the bottom diff --git a/.env.development b/.env.development index cf5645d4..dec6d4e5 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ G10_VALIDATOR_URL=http://localhost/validatorapi +G10_FHIR_RESOURCE_VALIDATOR_URL=http://localhost/hl7validatorapi V311_VALIDATOR_URL=http://localhost/validatorapi V400_VALIDATOR_URL=http://localhost/validatorapi V501_VALIDATOR_URL=http://localhost/validatorapi diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a4be4e1..f633c200 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 5.3.0 + +* Use HL7 validator wrapper (#488). +* Fix an issue identifying Coverage.identifier:membershipid.type Must Support + slice when it is not the first identifier (#504). +* Remove remaining US Core 5 references from descriptions (#506). + # 5.2.0 * Fix Must Support for Patient's previous name and address (#496). diff --git a/Gemfile b/Gemfile index 2a9cd3d0..9f312cf8 100644 --- a/Gemfile +++ b/Gemfile @@ -4,9 +4,6 @@ source "https://rubygems.org" gemspec -# rc1 has been released, but don't want to risk updating the day of our release -gem 'hanami-utils', '2.0.0.beta1' - group :development, :test do gem 'rubocop', '~> 1.9' gem 'rubocop-rspec', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 8284977c..3ce1cbc2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,17 +1,17 @@ PATH remote: . specs: - onc_certification_g10_test_kit (5.2.0) + onc_certification_g10_test_kit (5.3.0) bloomer (~> 1.0.0) colorize (~> 0.8.1) - inferno_core (~> 0.4.20) + inferno_core (~> 0.4.34) json-jwt (~> 1.15.3) mime-types (~> 3.4.0) ndjson (~> 1.0.0) rubyzip (~> 2.3.2) - smart_app_launch_test_kit (= 0.4.1) + smart_app_launch_test_kit (= 0.4.2) tls_test_kit (= 0.2.1) - us_core_test_kit (= 0.6.4) + us_core_test_kit (= 0.6.5) GEM remote: https://rubygems.org/ @@ -80,7 +80,8 @@ GEM dry-core (~> 0.5, >= 0.5) dry-inflector (~> 0.1, >= 0.1.2) dry-struct (~> 1.0) - dry-transformer (0.1.1) + dry-transformer (1.0.1) + zeitwerk (~> 2.6) dry-types (1.5.1) concurrent-ruby (~> 1.0) dry-container (~> 0.3) @@ -148,9 +149,9 @@ GEM mustermann (~> 1.0) mustermann-contrib (~> 1.0) rack (~> 2.0) - hanami-utils (2.0.0.beta1) + hanami-utils (2.0.0) concurrent-ruby (~> 1.0) - dry-transformer (~> 0.1) + dry-transformer (~> 1.0, < 2) hansi (0.2.1) hashdiff (1.0.1) http-accept (1.7.0) @@ -160,7 +161,7 @@ GEM i18n (1.14.4) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - inferno_core (0.4.30) + inferno_core (0.4.34) activesupport (~> 6.1.7.5) base62-rb (= 0.3.1) blueprinter (= 0.25.2) @@ -204,7 +205,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2024.0305) mini_portile2 (2.8.5) - minitest (5.22.2) + minitest (5.22.3) msgpack (1.7.2) multi_json (1.15.0) multi_xml (0.6.0) @@ -216,15 +217,15 @@ GEM mustermann (= 1.1.2) ndjson (1.0.0) netrc (0.11.0) - nio4r (2.7.0) - nokogiri (1.16.2) + nio4r (2.7.1) + nokogiri (1.16.3) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.2-arm64-darwin) + nokogiri (1.16.3-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86_64-darwin) + nokogiri (1.16.3-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86_64-linux) + nokogiri (1.16.3-x86_64-linux) racc (~> 1.4) oauth2 (1.4.11) faraday (>= 0.17.3, < 3.0) @@ -248,9 +249,9 @@ GEM puma (5.6.8) nio4r (~> 2.0) racc (1.7.3) - rack (2.2.8.1) + rack (2.2.9) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) redis (4.8.1) regexp_parser (2.6.1) reline (0.3.1) @@ -261,7 +262,7 @@ GEM mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rexml (3.2.6) - rouge (4.2.0) + rouge (4.2.1) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) @@ -300,16 +301,16 @@ GEM connection_pool (>= 2.2.5, < 3) rack (~> 2.0) redis (>= 4.5.0, < 5) - smart_app_launch_test_kit (0.4.1) + smart_app_launch_test_kit (0.4.2) inferno_core (>= 0.4.2) json-jwt (~> 1.15.3) jwt (~> 2.6) tls_test_kit (~> 0.2.0) - sqlite3 (1.7.2) + sqlite3 (1.7.3) mini_portile2 (~> 2.8.0) - sqlite3 (1.7.2-arm64-darwin) - sqlite3 (1.7.2-x86_64-darwin) - sqlite3 (1.7.2-x86_64-linux) + sqlite3 (1.7.3-arm64-darwin) + sqlite3 (1.7.3-x86_64-darwin) + sqlite3 (1.7.3-x86_64-linux) strings (0.2.1) strings-ansi (~> 0.2) unicode-display_width (>= 1.5, < 3.0) @@ -332,7 +333,7 @@ GEM concurrent-ruby (~> 1.0) unicode-display_width (2.5.0) unicode_utils (1.4.0) - us_core_test_kit (0.6.4) + us_core_test_kit (0.6.5) inferno_core (>= 0.4.2) smart_app_launch_test_kit (>= 0.4.0) tls_test_kit (~> 0.2.0) @@ -352,7 +353,6 @@ DEPENDENCIES database_cleaner-sequel (~> 1.8) debug factory_bot (~> 6.1) - hanami-utils (= 2.0.0.beta1) onc_certification_g10_test_kit! rspec (~> 3.10) rubocop (~> 1.9) diff --git a/config/nginx.background.conf b/config/nginx.background.conf index 1eeee5f7..95014fcb 100644 --- a/config/nginx.background.conf +++ b/config/nginx.background.conf @@ -86,20 +86,20 @@ http { # To enable the HL7 Validator Wrapper, both the section below and # the section in docker-compose.background.yml need to be uncommented -# location /hl7validatorapi/ { -# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -# proxy_set_header Host $http_host; -# proxy_set_header X-Forwarded-Proto $scheme; -# proxy_set_header X-Forwarded-Port $server_port; -# proxy_redirect off; -# proxy_set_header Connection ''; -# proxy_http_version 1.1; -# chunked_transfer_encoding off; -# proxy_buffering off; -# proxy_cache off; -# proxy_read_timeout 600s; -# -# proxy_pass http://hl7_validator_service:3500/; -# } + location /hl7validatorapi/ { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; + proxy_redirect off; + proxy_set_header Connection ''; + proxy_http_version 1.1; + chunked_transfer_encoding off; + proxy_buffering off; + proxy_cache off; + proxy_read_timeout 600s; + + proxy_pass http://hl7_validator_service:3500/; + } } } diff --git a/docker-compose.background.yml b/docker-compose.background.yml index 3aeb38ce..932426d8 100644 --- a/docker-compose.background.yml +++ b/docker-compose.background.yml @@ -28,14 +28,14 @@ services: volumes: - ./data/redis:/data command: redis-server --appendonly yes - # hl7_validator_service: - # image: infernocommunity/inferno-resource-validator:1.0.51 - # environment: - # # Defines how long validator sessions last if unused, in minutes: - # # Negative values mean sessions never expire, 0 means sessions immediately expire - # SESSION_CACHE_DURATION: -1 - # volumes: - # - ./lib/onc_certification_g10_test_kit/igs:/home/igs - # # To let the service share your local FHIR package cache, - # # uncomment the below line - # # - ~/.fhir:/home/ktor/.fhir \ No newline at end of file + hl7_validator_service: + image: infernocommunity/inferno-resource-validator:1.0.51 + environment: + # Defines how long validator sessions last if unused, in minutes: + # Negative values mean sessions never expire, 0 means sessions immediately expire + SESSION_CACHE_DURATION: -1 + volumes: + - ./lib/onc_certification_g10_test_kit/igs:/home/igs + # To let the service share your local FHIR package cache, + # uncomment the below line + # - ~/.fhir:/home/ktor/.fhir diff --git a/docker-compose.yml b/docker-compose.yml index 7c4f9159..75a72649 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: extends: file: docker-compose.background.yml service: redis - # hl7_validator_service: - # extends: - # file: docker-compose.background.yml - # service: hl7_validator_service \ No newline at end of file + hl7_validator_service: + extends: + file: docker-compose.background.yml + service: hl7_validator_service diff --git a/lib/onc_certification_g10_test_kit/bulk_data_authorization.rb b/lib/onc_certification_g10_test_kit/bulk_data_authorization.rb index 8266493d..0bf25de4 100644 --- a/lib/onc_certification_g10_test_kit/bulk_data_authorization.rb +++ b/lib/onc_certification_g10_test_kit/bulk_data_authorization.rb @@ -205,8 +205,6 @@ class BulkDataAuthorization < Inferno::TestGroup output :bearer_token run do - skip_if authentication_response.blank?, 'No authentication response received.' - assert_valid_json(authentication_response) response_body = JSON.parse(authentication_response) diff --git a/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1.rb b/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1.rb index 15117e8d..cb8d5dcb 100644 --- a/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1.rb +++ b/lib/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1.rb @@ -10,7 +10,8 @@ class BulkDataGroupExportCancelSTU1 < Inferno::TestGroup correct behavior. ) - input :bearer_token + input :bearer_token, + optional: true input :bulk_server_url, title: 'Bulk Data FHIR URL', description: 'The URL of the Bulk FHIR server.' diff --git a/lib/onc_certification_g10_test_kit/bulk_data_group_export_stu1.rb b/lib/onc_certification_g10_test_kit/bulk_data_group_export_stu1.rb index 7192cea8..cfe91152 100644 --- a/lib/onc_certification_g10_test_kit/bulk_data_group_export_stu1.rb +++ b/lib/onc_certification_g10_test_kit/bulk_data_group_export_stu1.rb @@ -137,8 +137,6 @@ class BulkDataGroupExportSTU1 < Inferno::TestGroup include ExportKickOffPerformer run do - skip_if bearer_token.blank?, 'Could not verify this functionality when bearer token is not set' - perform_export_kick_off_request(use_token: false) assert_response_status([400, 401]) end @@ -188,8 +186,6 @@ class BulkDataGroupExportSTU1 < Inferno::TestGroup output :status_response, :requires_access_token run do - skip 'Server response did not have Content-Location in header' unless polling_url.present? - timeout = bulk_timeout.to_i if !timeout.positive? @@ -262,8 +258,6 @@ class BulkDataGroupExportSTU1 < Inferno::TestGroup output :status_output, :bulk_download_url run do - assert status_response.present?, 'Bulk Data Server status response not found' - assert_valid_json(status_response) status_output = JSON.parse(status_response)['output'] assert status_output, 'Bulk Data Server status response does not contain output' diff --git a/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb b/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb index 792774be..bf06ede7 100644 --- a/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb +++ b/lib/onc_certification_g10_test_kit/bulk_data_group_export_validation.rb @@ -62,15 +62,11 @@ class BulkDataGroupExportValidation < Inferno::TestGroup DESCRIPTION # link 'http://hl7.org/fhir/uv/bulkdata/STU1.0.1/export/index.html#file-request' - input :bulk_download_url + input :bulk_download_url, :requires_access_token, :requires_access_token, :bearer_token run do - skip_if bulk_download_url.blank?, 'Could not verify this functionality when no download link was provided' - skip_if requires_access_token.blank?, - 'Could not verify this functionality when requiresAccessToken is not provided' omit_if requires_access_token == 'false', 'Could not verify this functionality when requiresAccessToken is false' - skip_if bearer_token.blank?, 'Could not verify this functionality when Bearer Token is not provided' get(bulk_download_url, headers: { accept: 'application/fhir+ndjson' }) assert_response_status([400, 401]) diff --git a/lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb b/lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb index cf6ab50f..0afa271f 100644 --- a/lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb +++ b/lib/onc_certification_g10_test_kit/smart_invalid_token_refresh_test.rb @@ -12,8 +12,6 @@ class SMARTInvalidTokenRefreshTest < Inferno::Test input :client_secret, optional: true run do - skip_if refresh_token.blank?, 'No refresh token was received' - oauth2_params = { 'grant_type' => 'refresh_token', 'refresh_token' => SecureRandom.uuid diff --git a/lib/onc_certification_g10_test_kit/version.rb b/lib/onc_certification_g10_test_kit/version.rb index fbaecf5e..84a44d31 100644 --- a/lib/onc_certification_g10_test_kit/version.rb +++ b/lib/onc_certification_g10_test_kit/version.rb @@ -1,3 +1,3 @@ module ONCCertificationG10TestKit - VERSION = '5.2.0'.freeze + VERSION = '5.3.0'.freeze end diff --git a/onc_certification_g10_matrix.xlsx b/onc_certification_g10_matrix.xlsx index 68fe5ed4..b59edab0 100644 Binary files a/onc_certification_g10_matrix.xlsx and b/onc_certification_g10_matrix.xlsx differ diff --git a/onc_certification_g10_test_kit.gemspec b/onc_certification_g10_test_kit.gemspec index 376d7970..4ead0bab 100644 --- a/onc_certification_g10_test_kit.gemspec +++ b/onc_certification_g10_test_kit.gemspec @@ -11,14 +11,14 @@ Gem::Specification.new do |spec| spec.license = 'Apache-2.0' spec.add_runtime_dependency 'bloomer', '~> 1.0.0' spec.add_runtime_dependency 'colorize', '~> 0.8.1' - spec.add_runtime_dependency 'inferno_core', '~> 0.4.20' + spec.add_runtime_dependency 'inferno_core', '~> 0.4.34' spec.add_runtime_dependency 'json-jwt', '~> 1.15.3' spec.add_runtime_dependency 'mime-types', '~> 3.4.0' spec.add_runtime_dependency 'ndjson', '~> 1.0.0' spec.add_runtime_dependency 'rubyzip', '~> 2.3.2' - spec.add_runtime_dependency 'smart_app_launch_test_kit', '0.4.1' + spec.add_runtime_dependency 'smart_app_launch_test_kit', '0.4.2' spec.add_runtime_dependency 'tls_test_kit', '0.2.1' - spec.add_runtime_dependency 'us_core_test_kit', '0.6.4' + spec.add_runtime_dependency 'us_core_test_kit', '0.6.5' spec.add_development_dependency 'database_cleaner-sequel', '~> 1.8' spec.add_development_dependency 'factory_bot', '~> 6.1' spec.add_development_dependency 'rspec', '~> 3.10' diff --git a/spec/onc_certification_g10_test_kit/bulk_data_authorization_spec.rb b/spec/onc_certification_g10_test_kit/bulk_data_authorization_spec.rb index 48e55428..bcc7abea 100644 --- a/spec/onc_certification_g10_test_kit/bulk_data_authorization_spec.rb +++ b/spec/onc_certification_g10_test_kit/bulk_data_authorization_spec.rb @@ -156,21 +156,21 @@ def run(runnable, inputs = {}) end it 'skips when no authentication response received' do - result = run(runnable) + result = run(runnable, input) expect(result.result).to eq('skip') - expect(result.result_message).to eq('No authentication response received.') + expect(result.result_message).to match(/authentication_response/) end it 'fails when authentication response is invalid JSON' do - result = run(runnable, { authentication_response: '{/}' }) + result = run(runnable, input.merge(authentication_response: '{/}')) expect(result.result).to eq('fail') expect(result.result_message).to eq('Invalid JSON. ') end it 'fails when authentication response does not contain access_token' do - result = run(runnable, { authentication_response: '{"response_body":"post"}' }) + result = run(runnable, input.merge(authentication_response: '{"response_body":"post"}')) expect(result.result).to eq('fail') expect(result.result_message).to eq('Token response did not contain access_token as required') @@ -178,14 +178,14 @@ def run(runnable, inputs = {}) it 'fails when access_token is present but does not contain required keys' do missing_key_auth_response = { 'access_token' => 'its_the_token' } - result = run(runnable, { authentication_response: missing_key_auth_response.to_json }) + result = run(runnable, input.merge(authentication_response: missing_key_auth_response.to_json)) expect(result.result).to eq('fail') expect(result.result_message).to eq('Token response did not contain token_type as required') end it 'passes when access_token is present and contains the required keys' do - result = run(runnable, { authentication_response: response_body.to_json }) + result = run(runnable, input.merge(authentication_response: response_body.to_json)) expect(result.result).to eq('pass') end diff --git a/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1_spec.rb b/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1_spec.rb index f125880b..d563825b 100644 --- a/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1_spec.rb +++ b/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu1_spec.rb @@ -35,7 +35,8 @@ def run(runnable, inputs = {}) let(:bulk_export_url) { "#{bulk_server_url}/Group/1219/$export" } it 'skips when no Bearer Token is given' do - result = run(runnable, { bearer_token: nil }) + base_input.delete(:bearer_token) + result = run(runnable, base_input) expect(result.result).to eq('skip') expect(result.result_message).to eq('Could not verify this functionality when bearer token is not set') diff --git a/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu2_spec.rb b/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu2_spec.rb index 18af3693..6b64027a 100644 --- a/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu2_spec.rb +++ b/spec/onc_certification_g10_test_kit/bulk_data_group_export_cancel_stu2_spec.rb @@ -27,7 +27,7 @@ def run(runnable, inputs = {}) stub_request(:get, url) .to_return(status: 202) - result = run(runnable, cancelled_polling_url: url) + result = run(runnable, cancelled_polling_url: url, bulk_server_url: 'foo', group_id: 'bar') expect(result.result).to eq('fail') expect(result.result_message).to match(/404/) @@ -37,7 +37,7 @@ def run(runnable, inputs = {}) stub_request(:get, url) .to_return(status: 404, body: '{}') - result = run(runnable, cancelled_polling_url: url) + result = run(runnable, cancelled_polling_url: url, bulk_server_url: 'foo', group_id: 'bar') expect(result.result).to eq('fail') expect(result.result_message).to match(/OperationOutcome/) @@ -48,7 +48,7 @@ def run(runnable, inputs = {}) .to_return(status: 404, body: FHIR::OperationOutcome.new.to_json) allow_any_instance_of(runnable).to receive(:assert_valid_resource).and_return(true) - result = run(runnable, cancelled_polling_url: url) + result = run(runnable, cancelled_polling_url: url, bulk_server_url: 'foo', group_id: 'bar') expect(result.result).to eq('pass') end diff --git a/spec/onc_certification_g10_test_kit/bulk_data_group_export_stu1_spec.rb b/spec/onc_certification_g10_test_kit/bulk_data_group_export_stu1_spec.rb index 7fe10ea7..65c1fb63 100644 --- a/spec/onc_certification_g10_test_kit/bulk_data_group_export_stu1_spec.rb +++ b/spec/onc_certification_g10_test_kit/bulk_data_group_export_stu1_spec.rb @@ -12,7 +12,8 @@ { bulk_server_url:, bearer_token:, - group_id: + group_id:, + bulk_timeout: '180' } end let(:capability_statement) { FHIR.from_contents(File.read('spec/fixtures/CapabilityStatement.json')) } @@ -143,7 +144,7 @@ def run(runnable, inputs = {}) result = run(runnable, bad_token_input) expect(result.result).to eq('skip') - expect(result.result_message).to eq('Could not verify this functionality when bearer token is not set') + expect(result.result_message).to match(/bearer_token/) end it 'fails if client can $export without authorization' do @@ -223,10 +224,10 @@ def run(runnable, inputs = {}) end it 'skips when polling_url is not provided' do - result = run(runnable) + result = run(runnable, base_input) expect(result.result).to eq('skip') - expect(result.result_message).to eq('Server response did not have Content-Location in header') + expect(result.result_message).to match(/polling_url/) end it 'skips when server only returns "202 Accepted", and not "200 OK" in the allowed timeframe' do @@ -309,29 +310,29 @@ def run(runnable, inputs = {}) status_output_json.to_json end - it 'fails when response not found' do - result = run(runnable) + it 'skips when response not found' do + result = run(runnable, base_input) - expect(result.result).to eq('fail') - expect(result.result_message).to eq('Bulk Data Server status response not found') + expect(result.result).to eq('skip') + expect(result.result_message).to match(/status_response/) end it 'fails when response does not contain output' do - result = run(runnable, { status_response: '{"no_output":"!"}' }) + result = run(runnable, base_input.merge(status_response: '{"no_output":"!"}')) expect(result.result).to eq('fail') expect(result.result_message).to eq('Bulk Data Server status response does not contain output') end it 'fails when output does not contain required attributes' do - result = run(runnable, { status_response: bad_status_output }) + result = run(runnable, base_input.merge(status_response: bad_status_output)) expect(result.result).to eq('fail') expect(result.result_message).to eq('Output file did not contain "type" as required') end it 'passes when response contains output with required attributes' do - result = run(runnable, { status_response: status_output }) + result = run(runnable, base_input.merge(status_response: status_output)) expect(result.result).to eq('pass') end diff --git a/spec/onc_certification_g10_test_kit/bulk_data_group_export_validation_spec.rb b/spec/onc_certification_g10_test_kit/bulk_data_group_export_validation_spec.rb index 595d8627..84ff78b7 100644 --- a/spec/onc_certification_g10_test_kit/bulk_data_group_export_validation_spec.rb +++ b/spec/onc_certification_g10_test_kit/bulk_data_group_export_validation_spec.rb @@ -20,7 +20,8 @@ { requires_access_token: 'true', status_output:, - bearer_token: + bearer_token:, + bulk_download_url: endpoint } end @@ -43,32 +44,35 @@ def run(runnable, inputs = {}) let(:runnable) { group.tests[1] } it 'skips when bulk_download_url is not provided' do - result = run(runnable) + input.delete(:bulk_download_url) + result = run(runnable, input) expect(result.result).to eq('skip') - expect(result.result_message).to eq('Could not verify this functionality when no download link was provided') + expect(result.result_message).to match(/bulk_download_url/) end it 'skips when requires_access_token is not provided' do - result = run(runnable, { bulk_download_url: endpoint }) + input.delete(:requires_access_token) + result = run(runnable, input) expect(result.result).to eq('skip') - expect(result.result_message) - .to eq('Could not verify this functionality when requiresAccessToken is not provided') + expect(result.result_message).to match(/requires_access_token/) end it 'omits when requiresAccessToken is false' do - result = run(runnable, { requires_access_token: 'false', bulk_download_url: endpoint }) + input[:requires_access_token] = 'false' + result = run(runnable, input) expect(result.result).to eq('omit') expect(result.result_message).to eq('Could not verify this functionality when requiresAccessToken is false') end it 'skips when bearer_token is not provided' do - result = run(runnable, { requires_access_token: 'true', bulk_download_url: endpoint }) + input.delete(:bearer_token) + result = run(runnable, input) expect(result.result).to eq('skip') - expect(result.result_message).to eq('Could not verify this functionality when Bearer Token is not provided') + expect(result.result_message).to match(/bearer_token/) end context 'when bulk_download_url and bearer_token are given and requiresAccessToken is true' do @@ -208,7 +212,7 @@ def run(runnable, inputs = {}) let(:runnable) { group.tests[3] } it 'skips when no patient ids have been stored' do - result = run(runnable) + result = run(runnable, input) expect(result.result).to eq('skip') expect(result.result_message).to eq('No Patient resources processed from bulk data export.') @@ -216,7 +220,7 @@ def run(runnable, inputs = {}) it 'fails when less than two patient ids are stored' do scratch[:patient_ids_seen] = ['one_id'] - result = run(runnable) + result = run(runnable, input) expect(result.result).to eq('fail') expect(result.result_message).to eq('Bulk data export did not have multiple Patient resources.') @@ -224,7 +228,7 @@ def run(runnable, inputs = {}) it 'passes when two or more patient ids are stored' do scratch[:patient_ids_seen] = ['one_id', 'two_id'] - result = run(runnable) + result = run(runnable, input) expect(result.result).to eq('pass') end @@ -232,10 +236,10 @@ def run(runnable, inputs = {}) describe '[Patient IDs match those expected in Group]' do let(:runnable) { group.tests[4] } - let(:input) { { bulk_patient_ids_in_group: 'one_id, two_id, three_id' } } + let(:patient_input) { input.merge(bulk_patient_ids_in_group: 'one_id, two_id, three_id') } it 'omits when no patient ids have been stored' do - result = run(runnable) + result = run(runnable, input) expect(result.result).to eq('omit') expect(result.result_message).to eq('No patient ids were given.') @@ -243,7 +247,7 @@ def run(runnable, inputs = {}) it 'fails when the input patient ids do not match those stored' do scratch[:patient_ids_seen] = ['one_id', 'one_id', 'one_id'] - result = run(runnable, input) + result = run(runnable, patient_input) expect(result.result).to eq('fail') expect(result.result_message).to eq('Mismatch between patient ids seen (one_id, one_id, one_id) and patient ' \ @@ -252,7 +256,7 @@ def run(runnable, inputs = {}) it 'fails when more input patient ids than ids stored' do scratch[:patient_ids_seen] = ['one_id', 'two_id'] - result = run(runnable, input) + result = run(runnable, patient_input) expect(result.result).to eq('fail') expect(result.result_message).to eq('Mismatch between patient ids seen (one_id, two_id) and patient ' \ @@ -261,7 +265,7 @@ def run(runnable, inputs = {}) it 'fails when less input patient ids than ids stored' do scratch[:patient_ids_seen] = ['one_id', 'two_id', 'three_id', 'four_id'] - result = run(runnable, input) + result = run(runnable, patient_input) expect(result.result).to eq('fail') expect(result.result_message).to eq('Mismatch between patient ids seen (one_id, two_id, three_id, four_id) ' \ @@ -270,7 +274,7 @@ def run(runnable, inputs = {}) it 'passes when the input patient ids do not match those stored' do scratch[:patient_ids_seen] = ['one_id', 'two_id', 'three_id'] - result = run(runnable, input) + result = run(runnable, patient_input) expect(result.result).to eq('pass') end diff --git a/spec/onc_certification_g10_test_kit/single_patient_api_group_spec.rb b/spec/onc_certification_g10_test_kit/single_patient_api_group_spec.rb index 932df17f..85da3d61 100644 --- a/spec/onc_certification_g10_test_kit/single_patient_api_group_spec.rb +++ b/spec/onc_certification_g10_test_kit/single_patient_api_group_spec.rb @@ -20,20 +20,20 @@ def run(runnable, inputs = {}) let(:test) { described_class.tests.first } it 'does not raise an error when additional_patient_ids is not provided' do - result = run(test, patient_id: '85') + result = run(test, patient_id: '85', url: 'foo') expect(result.result).to eq('pass') end it 'outputs the correct patient_ids when additional_patient_ids is not provided' do - run(test, patient_id: '85') + run(test, patient_id: '85', url: 'foo') patient_ids = session_data_repo.load(test_session_id: test_session.id, name: 'patient_ids') expect(patient_ids).to eq('85') end it 'outputs the correct patient_ids when additional_patient_ids are provided' do - run(test, patient_id: '85', additional_patient_ids: '85 , 123,, , 456 ,789') + run(test, patient_id: '85', additional_patient_ids: '85 , 123,, , 456 ,789', url: 'foo') patient_ids = session_data_repo.load(test_session_id: test_session.id, name: 'patient_ids') expect(patient_ids).to eq('85,123,456,789') diff --git a/spec/onc_certification_g10_test_kit/smart_invalid_token_refresh_test_spec.rb b/spec/onc_certification_g10_test_kit/smart_invalid_token_refresh_test_spec.rb index db282b86..fa75f213 100644 --- a/spec/onc_certification_g10_test_kit/smart_invalid_token_refresh_test_spec.rb +++ b/spec/onc_certification_g10_test_kit/smart_invalid_token_refresh_test_spec.rb @@ -32,7 +32,7 @@ def run(runnable, inputs = {}) result = run(test, default_inputs) expect(result.result).to eq('skip') - expect(result.result_message).to match(/No refresh token/) + expect(result.result_message).to match(/refresh_token/) end it 'fails if the token request succeeds' do diff --git a/spec/onc_certification_g10_test_kit/smart_scopes_test_spec.rb b/spec/onc_certification_g10_test_kit/smart_scopes_test_spec.rb index d90f543f..2fb76a5e 100644 --- a/spec/onc_certification_g10_test_kit/smart_scopes_test_spec.rb +++ b/spec/onc_certification_g10_test_kit/smart_scopes_test_spec.rb @@ -30,7 +30,7 @@ def run(runnable, inputs = {}) context 'with requested scopes' do it 'fails if a required scope was not requested' do - result = run(test, requested_scopes: 'online_access launch') + result = run(test, requested_scopes: 'online_access launch', received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to eq('Required scopes were not requested: offline_access') @@ -38,7 +38,7 @@ def run(runnable, inputs = {}) it 'fails if a scope has an invalid format' do ['patient/*/read', 'patient*.read', 'patient/*.*.read', 'patient/*.readx'].each do |bad_scope| - result = run(test, requested_scopes: "#{base_scopes} #{bad_scope}") + result = run(test, requested_scopes: "#{base_scopes} #{bad_scope}", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('does not follow the format') @@ -48,7 +48,7 @@ def run(runnable, inputs = {}) it 'fails if a patient compartment resource has a user-level scope' do bad_scope = 'user/Patient.read' - result = run(test, requested_scopes: "#{base_scopes} user/Binary.read #{bad_scope}") + result = run(test, requested_scopes: "#{base_scopes} user/Binary.read #{bad_scope}", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('does not follow the format') @@ -57,7 +57,7 @@ def run(runnable, inputs = {}) it 'fails if a scope for a disallowed resource type is requested' do bad_scope = 'patient/CodeSystem.read' - result = run(test, requested_scopes: "#{base_scopes} #{bad_scope}") + result = run(test, requested_scopes: "#{base_scopes} #{bad_scope}", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('must be either a permitted resource type') @@ -65,7 +65,7 @@ def run(runnable, inputs = {}) end it 'fails if no patient-level scopes were requested' do - result = run(test, requested_scopes: "#{base_scopes} user/Binary.read") + result = run(test, requested_scopes: "#{base_scopes} user/Binary.read", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('Patient-level scope in the format') @@ -77,7 +77,7 @@ def run(runnable, inputs = {}) allow_any_instance_of(test).to receive(:scope_version).and_return(:v1) bad_scope = 'patient/Patient.r' - result = run(test, requested_scopes: "#{base_scopes} user/Binary.read #{bad_scope}") + result = run(test, requested_scopes: "#{base_scopes} user/Binary.read #{bad_scope}", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('does not follow the format') @@ -90,7 +90,7 @@ def run(runnable, inputs = {}) allow_any_instance_of(test).to receive(:scope_version).and_return(:v2) bad_scope = 'patient/Patient.read' - result = run(test, requested_scopes: "#{base_scopes} user/Binary.rs #{bad_scope}") + result = run(test, requested_scopes: "#{base_scopes} user/Binary.rs #{bad_scope}", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('does not follow the format') @@ -127,7 +127,7 @@ def run(runnable, inputs = {}) context 'with requested scopes' do it 'fails if a patient-level scope is requested' do bad_scope = 'patient/Patient.read' - result = run(test, requested_scopes: "#{base_scopes} user/Binary.read #{bad_scope}") + result = run(test, requested_scopes: "#{base_scopes} user/Binary.read #{bad_scope}", received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('does not follow the format') @@ -135,7 +135,7 @@ def run(runnable, inputs = {}) end it 'fails if no user-level scopes were requested' do - result = run(test, requested_scopes: base_scopes) + result = run(test, requested_scopes: base_scopes, received_scopes: 'foo') expect(result.result).to eq('fail') expect(result.result_message).to match('User-level scope in the format')