From 37fbf30b64ee6f8feab1cce91589a3db98c95067 Mon Sep 17 00:00:00 2001 From: Kevin De Pelseneer Date: Tue, 29 Oct 2024 12:58:18 +0100 Subject: [PATCH] PR comments --- app/controllers/samples_controller.rb | 1 - test/functional/samples_controller_test.rb | 21 ++++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/app/controllers/samples_controller.rb b/app/controllers/samples_controller.rb index db908a80bb..a90a817058 100644 --- a/app/controllers/samples_controller.rb +++ b/app/controllers/samples_controller.rb @@ -334,7 +334,6 @@ def filter_linked_samples(samples, link, options, template_attribute) raise ArgumentError, "Invalid linking method provided. '#{link}' is not allowed!" end - # template_attribute_title = template_attribute&.title samples.select do |s| s.send(link).any? do |x| selected = match_attribute_value(x, template_attribute, options[:attribute_value]) diff --git a/test/functional/samples_controller_test.rb b/test/functional/samples_controller_test.rb index c38186a66e..6388da2ac8 100644 --- a/test/functional/samples_controller_test.rb +++ b/test/functional/samples_controller_test.rb @@ -7,15 +7,6 @@ class SamplesControllerTest < ActionController::TestCase include HtmlHelper include GeneralAuthorizationTestCases - def setup - @source_characteristic_isa_tag = FactoryBot.create(:source_characteristic_isa_tag) - @sample_characteristic_isa_tag = FactoryBot.create(:sample_characteristic_isa_tag) - @other_material_characteristic_isa_tag = FactoryBot.create(:other_material_characteristic_isa_tag) - Seek::Samples::BaseType::ALL_TYPES.each do |type| - FactoryBot.create(:string_sample_attribute_type, title: "#{type} attibute type", base_type: type) - end - end - test 'should return 406 when requesting RDF' do login_as(FactoryBot.create(:user)) sample = FactoryBot.create :sample, contributor: User.current_user.person @@ -1274,6 +1265,7 @@ def setup end test 'query samples by template attributes for \'seek sample\' type' do + setup_est_query with_config_value(:isa_json_compliance_enabled, true) do person, project, template1, template2, template3, type1, type2, type3 = template_query_setup.values_at(:person, :project, :begin_template, :middle_template, :end_template, :begin_type, :middle_type, :end_type) login_as(person) @@ -1400,6 +1392,7 @@ def setup end test 'query samples by template attributes for \'boolean\' type' do + setup_est_query with_config_value(:isa_json_compliance_enabled, true) do person, project, template1, template2, template3, type1, type2, type3 = template_query_setup(Seek::Samples::BaseType::BOOLEAN).values_at(:person, :project, :begin_template, :middle_template, :end_template, :begin_type, :middle_type, :end_type) @@ -1559,6 +1552,7 @@ def setup end test 'query samples by template attributes for numeric types' do + setup_est_query # Numeric types # Integer # Float @@ -1811,6 +1805,15 @@ def setup private + def setup_est_query + @source_characteristic_isa_tag = FactoryBot.create(:source_characteristic_isa_tag) + @sample_characteristic_isa_tag = FactoryBot.create(:sample_characteristic_isa_tag) + @other_material_characteristic_isa_tag = FactoryBot.create(:other_material_characteristic_isa_tag) + Seek::Samples::BaseType::ALL_TYPES.each do |type| + FactoryBot.create(:string_sample_attribute_type, title: "#{type} attibute type", base_type: type) + end + end + def populated_patient_sample person = FactoryBot.create(:person) sample = Sample.new title: 'My Sample', policy: FactoryBot.create(:public_policy),