From e0ccd786767ffd173eef2a45db1ca6662c56c274 Mon Sep 17 00:00:00 2001 From: degradification Date: Tue, 19 Nov 2024 14:46:12 -0500 Subject: [PATCH] Updated parameter in dtr_questionnaire_rendering_attestation_test.rb to use token instead of client_id -Addressed rubocop warnings -Changed lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb to extract the session identifier from the new parameter name using the extract_token_from_query_params -Updated tests to use the correct token definition --- ...r_questionnaire_rendering_attestation_test.rb | 11 +++++++---- lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb | 4 ++-- .../dtr_questionnaire_rendering_group_spec.rb | 16 ++++++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb b/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb index b00d890..2e8e76b 100644 --- a/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb +++ b/lib/davinci_dtr_test_kit/client_groups/resp_assist_device/dtr_questionnaire_rendering_attestation_test.rb @@ -10,21 +10,24 @@ class DTRQuestionnaireRenderingAttestationTest < Inferno::Test This test provides the tester an opportunity to observe their client application following the receipt of the questionnaire package and attest that the application renders the questionnaire. ) - input :client_id + + def token + SecureRandom.uuid + end run do load_tagged_requests QUESTIONNAIRE_PACKAGE_TAG skip_if request.blank?, 'A Questionnaire Package request must be made prior to running this test' wait( - identifier: client_id, + identifier: token, message: %( I attest that the client application displays the questionnaire and respects the following rendering style: - The "Signature" field label is rendered with green text - [Click here](#{resume_pass_url}?client_id=#{client_id}) if the above statement is **true**. + [Click here](#{resume_pass_url}?token=#{token}) if the above statement is **true**. - [Click here](#{resume_fail_url}?client_id=#{client_id}) if the above statement is **false**. + [Click here](#{resume_fail_url}?token=#{token}) if the above statement is **false**. ) ) end diff --git a/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb b/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb index 060a39b..18f7e72 100644 --- a/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb +++ b/lib/davinci_dtr_test_kit/dtr_smart_app_suite.rb @@ -100,11 +100,11 @@ class DTRSmartAppSuite < Inferno::TestSuite end resume_test_route :get, RESUME_PASS_PATH do |request| - DTRSmartAppSuite.extract_client_id_from_query_params(request) + DTRSmartAppSuite.extract_token_from_query_params(request) end resume_test_route :get, RESUME_FAIL_PATH, result: 'fail' do |request| - DTRSmartAppSuite.extract_client_id_from_query_params(request) + DTRSmartAppSuite.extract_token_from_query_params(request) end # TODO: Update based on SMART Launch changes. Do we even want to have this group now? diff --git a/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb b/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb index 3390d69..b9d87e3 100644 --- a/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb +++ b/spec/davinci_dtr_test_kit/dtr_questionnaire_rendering_group_spec.rb @@ -20,7 +20,7 @@ def run(runnable, test_session, inputs = {}) test_session_id: test_session.id, name:, value:, - type: runnable.config.input_type(name) + type: runnable.config.input_type(name) || :text ) end Inferno::TestRunner.new(test_session:, test_run:).run(runnable) @@ -29,7 +29,11 @@ def run(runnable, test_session, inputs = {}) describe 'Behavior of questionnaire rendering attestation test' do let(:runnable) { group.tests.find { |test| test.id.to_s.end_with? 'dtr_questionnaire_rendering_attestation' } } let(:results_repo) { Inferno::Repositories::Results.new } - let(:client_id) { '1234' } + let(:token) { '1234' } + + before do + allow_any_instance_of(runnable).to receive(:token).and_return(token) + end it 'passes if affirmative attestation is given' do # For some reason it seems to completely ignore an allow...receive for resume_pass_url, so do this instead @@ -41,10 +45,10 @@ def run(runnable, test_session, inputs = {}) repo_create(:request, result_id: result.id, name: 'questionnaire_package', request_body: nil, test_session_id: test_session.id, tags: [DaVinciDTRTestKit::QUESTIONNAIRE_PACKAGE_TAG]) - result = run(runnable, test_session, client_id:) + result = run(runnable, test_session) expect(result.result).to eq('wait') - get("#{resume_pass_url}?client_id=#{client_id}") + get("#{resume_pass_url}?token=#{token}") result = results_repo.find(result.id) expect(result.result).to eq('pass') @@ -60,10 +64,10 @@ def run(runnable, test_session, inputs = {}) repo_create(:request, result_id: result.id, name: 'questionnaire_package', request_body: nil, test_session_id: test_session.id, tags: [DaVinciDTRTestKit::QUESTIONNAIRE_PACKAGE_TAG]) - result = run(runnable, test_session, client_id:) + result = run(runnable, test_session) expect(result.result).to eq('wait') - get("#{resume_fail_url}?client_id=#{client_id}") + get("#{resume_fail_url}?token=#{token}") result = results_repo.find(result.id) expect(result.result).to eq('fail')