From 289c532344ee84c3aed4f772d21824fb46213472 Mon Sep 17 00:00:00 2001 From: Syphax Date: Fri, 25 Oct 2024 11:12:52 +0200 Subject: [PATCH] add password reset token expiration --- helpers/application_helper.rb | 9 +- helpers/submission_helper.rb | 4 +- .../test_collections_controller.rb | 4 +- .../test_dereference_resource_controller.rb | 4 +- .../test_external_mappings_controller.rb | 3 +- .../test_ontology_analytics_controller.rb | 258 +++++++++--------- .../test_ontology_submissions_controller.rb | 4 +- test/controllers/test_schemes_controller.rb | 4 +- .../test_search_models_controller.rb | 4 +- .../test_skos_xl_label_controller.rb | 4 +- 10 files changed, 147 insertions(+), 151 deletions(-) diff --git a/helpers/application_helper.rb b/helpers/application_helper.rb index 8c2e2332..51bd4f08 100644 --- a/helpers/application_helper.rb +++ b/helpers/application_helper.rb @@ -276,7 +276,7 @@ def month_param(params=nil) if params["month"] month = params["month"].strip if %r{(?^(0[1-9]|[1-9]|1[0-2])$)}x === month - month.to_i.to_s + return month.to_i.to_s end end nil @@ -288,7 +288,7 @@ def year_param(params=nil) if params["year"] year = params["year"].strip if %r{(?^([1-2]\d{3})$)}x === year - year.to_i.to_s + return year.to_i.to_s end end nil @@ -401,11 +401,6 @@ def get_ontology_and_submission if !submission.ready?(status: [:RDF]) error 404, "Ontology #{@params["ontology"]} submission #{submission.submissionId} has not been parsed." end - if submission.nil? - if submission.nil? - error 404, "Ontology #{@params["acronym"]} does not have any submissions" - end - end save_submission_language(submission) diff --git a/helpers/submission_helper.rb b/helpers/submission_helper.rb index b79737d0..3c282416 100644 --- a/helpers/submission_helper.rb +++ b/helpers/submission_helper.rb @@ -51,6 +51,8 @@ def retrieve_submissions(options) submissions_query = submissions_query.where({ submissionStatus: [code: status] }) end + submissions_query = submissions_query.order_by(order_by) unless order_by.nil? + submissions_query = apply_submission_filters(submissions_query) submissions_query = submissions_query.filter(Goo::Filter.new(ontology: [:viewOf]).unbound) unless include_views submissions_query = submissions_query.filter(filter) if filter? @@ -72,4 +74,4 @@ def include_ready?(options) end end -helpers Sinatra::Helpers::SubmissionHelper \ No newline at end of file +helpers Sinatra::Helpers::SubmissionHelper diff --git a/test/controllers/test_collections_controller.rb b/test/controllers/test_collections_controller.rb index b7bc6f1b..11986f81 100644 --- a/test/controllers/test_collections_controller.rb +++ b/test/controllers/test_collections_controller.rb @@ -2,7 +2,7 @@ class TestCollectionsController < TestCase - def self.before_suite + def before_suite LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, process_options: {process_rdf: true, extract_metadata: false}, @@ -19,7 +19,7 @@ def self.before_suite sub.save end - def self.after_suite + def after_suite LinkedData::SampleData::Ontology.delete_ontologies_and_submissions end diff --git a/test/controllers/test_dereference_resource_controller.rb b/test/controllers/test_dereference_resource_controller.rb index e828a5a1..03427c41 100644 --- a/test/controllers/test_dereference_resource_controller.rb +++ b/test/controllers/test_dereference_resource_controller.rb @@ -3,7 +3,7 @@ class TestDereferenceResourceController < TestCase - def self.before_suite + def before_suite LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, process_options: { process_rdf: true, extract_metadata: false, generate_missing_labels: false}, @@ -192,4 +192,4 @@ def sort_nested_hash(hash) sorted_hash.sort.to_h end -end \ No newline at end of file +end diff --git a/test/controllers/test_external_mappings_controller.rb b/test/controllers/test_external_mappings_controller.rb index cb1f255f..0a18bf63 100644 --- a/test/controllers/test_external_mappings_controller.rb +++ b/test/controllers/test_external_mappings_controller.rb @@ -2,7 +2,7 @@ class TestExternalMappingsController < TestCase - def self.before_suite + def before_suite ["BRO-TEST-MAP-0", "CNO-TEST-MAP-0", "FAKE-TEST-MAP-0"].each do |acr| LinkedData::Models::OntologySubmission.where(ontology: [acronym: acr]).to_a.each do |s| s.delete @@ -147,4 +147,3 @@ def delete_interportal_mappings end end - diff --git a/test/controllers/test_ontology_analytics_controller.rb b/test/controllers/test_ontology_analytics_controller.rb index 9efa219a..a37ffbc9 100644 --- a/test/controllers/test_ontology_analytics_controller.rb +++ b/test/controllers/test_ontology_analytics_controller.rb @@ -3,195 +3,195 @@ class TestOntologyAnalyticsController < TestCase ANALYTICS_DATA = { "NCIT" => { - "2013" => { - "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "10" => 2850, "11" => 1631, "12" => 1323 + 2013 => { + 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 2850, 11 => 1631, 12 => 1323 }, - "2014" => { - "1" => 1004, "2" => 1302, "3" => 2183, "4" => 2191, "5" => 1005, "6" => 1046, "7" => 1261, "8" => 1329, "9" => 1100, "10" => 956, "11" => 1105, "12" => 893 + 2014 => { + 1 => 1004, 2 => 1302, 3 => 2183, 4 => 2191, 5 => 1005, 6 => 1046, 7 => 1261, 8 => 1329, 9 => 1100, 10 => 956, 11 => 1105, 12 => 893 }, - "2015" => { - "1" => 840, "2" => 30, "3" => 50, "4" => 20, "5" => 30, "6" => 10, "7" => 100, "8" => 80, "9" => 20, "10" => 90, "11" => 200, "12" => 50 + 2015 => { + 1 => 840, 2 => 30, 3 => 50, 4 => 20, 5 => 30, 6 => 10, 7 => 100, 8 => 80, 9 => 20, 10 => 90, 11 => 200, 12 => 50 }, - "2016" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 520, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2016 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 520, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2017" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 220, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 170, "11" => 750, "12" => 730 + 2017 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 220, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 170, 11 => 750, 12 => 730 }, - "2018" => { - "1" => 2000, "2" => 220, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 120, "11" => 750, "12" => 730 + 2018 => { + 1 => 2000, 2 => 220, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 120, 11 => 750, 12 => 730 }, - "2019" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2019 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2020" => { - "1" => 2000, "2" => 210, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2020 => { + 1 => 2000, 2 => 210, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2021" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 550, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2021 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 550, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2022" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 990, "7" => 340, "8" => 320, "9" => 610, "10" => 180, "11" => 750, "12" => 730 + 2022 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 990, 7 => 340, 8 => 320, 9 => 610, 10 => 180, 11 => 750, 12 => 730 } }, "ONTOMA" => { - "2013" => { - "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "10" => 6, "11" => 15, "12" => 0 + 2013 => { + 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 6, 11 => 15, 12 => 0 }, - "2014" => { - "1" => 2, "2" => 0, "3" => 0, "4" => 2, "5" => 2, "6" => 0, "7" => 6, "8" => 8, "9" => 0, "10" => 0, "11" => 0, "12" => 2 + 2014 => { + 1 => 2, 2 => 0, 3 => 0, 4 => 2, 5 => 2, 6 => 0, 7 => 6, 8 => 8, 9 => 0, 10 => 0, 11 => 0, 12 => 2 }, - "2015" => { - "1" => 30, "2" => 90, "3" => 90, "4" => 50, "5" => 30, "6" => 20, "7" => 80, "8" => 90, "9" => 250, "10" => 230, "11" => 120, "12" => 70 + 2015 => { + 1 => 30, 2 => 90, 3 => 90, 4 => 50, 5 => 30, 6 => 20, 7 => 80, 8 => 90, 9 => 250, 10 => 230, 11 => 120, 12 => 70 }, - "2016" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 520, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2016 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 520, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2017" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 220, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 170, "11" => 750, "12" => 730 + 2017 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 220, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 170, 11 => 750, 12 => 730 }, - "2018" => { - "1" => 2000, "2" => 220, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 120, "11" => 750, "12" => 730 + 2018 => { + 1 => 2000, 2 => 220, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 120, 11 => 750, 12 => 730 }, - "2019" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2019 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2020" => { - "1" => 2000, "2" => 210, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2020 => { + 1 => 2000, 2 => 210, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2021" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 550, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2021 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 550, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2022" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 990, "7" => 340, "8" => 320, "9" => 610, "10" => 180, "11" => 750, "12" => 730 + 2022 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 990, 7 => 340, 8 => 320, 9 => 610, 10 => 180, 11 => 750, 12 => 730 } }, "CMPO" => { - "2013" => { - "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "10" => 64, "11" => 75, "12" => 22 + 2013 => { + 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 64, 11 => 75, 12 => 22 }, - "2014" => { - "1" => 15, "2" => 15, "3" => 19, "4" => 12, "5" => 13, "6" => 14, "7" => 22, "8" => 12, "9" => 36, "10" => 6, "11" => 8, "12" => 10 + 2014 => { + 1 => 15, 2 => 15, 3 => 19, 4 => 12, 5 => 13, 6 => 14, 7 => 22, 8 => 12, 9 => 36, 10 => 6, 11 => 8, 12 => 10 }, - "2015" => { - "1" => 7, "2" => 40, "3" => 140, "4" => 320, "5" => 560, "6" => 320, "7" => 210, "8" => 230, "9" => 220, "10" => 10, "11" => 220, "12" => 880 + 2015 => { + 1 => 7, 2 => 40, 3 => 140, 4 => 320, 5 => 560, 6 => 320, 7 => 210, 8 => 230, 9 => 220, 10 => 10, 11 => 220, 12 => 880 }, - "2016" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 520, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2016 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 520, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2017" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 220, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 170, "11" => 750, "12" => 30 + 2017 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 220, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 170, 11 => 750, 12 => 30 }, - "2018" => { - "1" => 2000, "2" => 220, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 120, "11" => 750, "12" => 430 + 2018 => { + 1 => 2000, 2 => 220, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 120, 11 => 750, 12 => 430 }, - "2019" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 830 + 2019 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 830 }, - "2020" => { - "1" => 2000, "2" => 210, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 380 + 2020 => { + 1 => 2000, 2 => 210, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 380 }, - "2021" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 550, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 794 + 2021 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 550, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 794 }, - "2022" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 990, "7" => 340, "8" => 320, "9" => 610, "10" => 180, "11" => 750, "12" => 738 + 2022 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 990, 7 => 340, 8 => 320, 9 => 610, 10 => 180, 11 => 750, 12 => 738 } }, "AEO" => { - "2013" => { - "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "10" => 129, "11" => 142, "12" => 70 + 2013 => { + 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 129, 11 => 142, 12 => 70 }, - "2014" => { - "1" => 116, "2" => 93, "3" => 85, "4" => 132, "5" => 96, "6" => 137, "7" => 69, "8" => 158, "9" => 123, "10" => 221, "11" => 163, "12" => 43 + 2014 => { + 1 => 116, 2 => 93, 3 => 85, 4 => 132, 5 => 96, 6 => 137, 7 => 69, 8 => 158, 9 => 123, 10 => 221, 11 => 163, 12 => 43 }, - "2015" => { - "1" => 25, "2" => 230, "3" => 330, "4" => 220, "5" => 650, "6" => 320, "7" => 840, "8" => 440, "9" => 220, "10" => 110, "11" => 210, "12" => 270 + 2015 => { + 1 => 25, 2 => 230, 3 => 330, 4 => 220, 5 => 650, 6 => 320, 7 => 840, 8 => 440, 9 => 220, 10 => 110, 11 => 210, 12 => 270 }, - "2016" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 520, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 335 + 2016 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 520, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 335 }, - "2017" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 220, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 170, "11" => 750, "12" => 732 + 2017 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 220, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 170, 11 => 750, 12 => 732 }, - "2018" => { - "1" => 2000, "2" => 220, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 120, "11" => 750, "12" => 734 + 2018 => { + 1 => 2000, 2 => 220, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 120, 11 => 750, 12 => 734 }, - "2019" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 790 + 2019 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 790 }, - "2020" => { - "1" => 2000, "2" => 210, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 350 + 2020 => { + 1 => 2000, 2 => 210, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 350 }, - "2021" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 550, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 730 + 2021 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 550, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 730 }, - "2022" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 990, "7" => 340, "8" => 320, "9" => 610, "10" => 180, "11" => 750, "12" => 730 + 2022 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 990, 7 => 340, 8 => 320, 9 => 610, 10 => 180, 11 => 750, 12 => 730 } }, "SNOMEDCT" => { - "2013" => { - "1" => 0, "2" => 0, "3" => 0, "4" => 0, "5" => 0, "6" => 0, "7" => 0, "8" => 0, "9" => 0, "10" => 20721, "11" => 22717, "12" => 18565 + 2013 => { + 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0, 6 => 0, 7 => 0, 8 => 0, 9 => 0, 10 => 20721, 11 => 22717, 12 => 18565 }, - "2014" => { - "1" => 17966, "2" => 17212, "3" => 20942, "4" => 20376, "5" => 21063, "6" => 18734, "7" => 18116, "8" => 18676, "9" => 15728, "10" => 16348, "11" => 13933, "12" => 9533 + 2014 => { + 1 => 17966, 2 => 17212, 3 => 20942, 4 => 20376, 5 => 21063, 6 => 18734, 7 => 18116, 8 => 18676, 9 => 15728, 10 => 16348, 11 => 13933, 12 => 9533 }, - "2015" => { - "1" => 9036, "2" => 430, "3" => 550, "4" => 110, "5" => 990, "6" => 320, "7" => 630, "8" => 250, "9" => 270, "10" => 880, "11" => 330, "12" => 280 + 2015 => { + 1 => 9036, 2 => 430, 3 => 550, 4 => 110, 5 => 990, 6 => 320, 7 => 630, 8 => 250, 9 => 270, 10 => 880, 11 => 330, 12 => 280 }, - "2016" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 520, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 230 + 2016 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 520, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 230 }, - "2017" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 220, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 170, "11" => 750, "12" => 130 + 2017 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 220, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 170, 11 => 750, 12 => 130 }, - "2018" => { - "1" => 2000, "2" => 220, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 120, "11" => 750, "12" => 330 + 2018 => { + 1 => 2000, 2 => 220, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 120, 11 => 750, 12 => 330 }, - "2019" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 920 + 2019 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 920 }, - "2020" => { - "1" => 2000, "2" => 210, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 130 + 2020 => { + 1 => 2000, 2 => 210, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 130 }, - "2021" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 550, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 930 + 2021 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 550, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 930 }, - "2022" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 990, "7" => 340, "8" => 320, "9" => 610, "10" => 180, "11" => 750, "12" => 230 + 2022 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 990, 7 => 340, 8 => 320, 9 => 610, 10 => 180, 11 => 750, 12 => 230 } }, "TST" => { - "2013" => { - "1" => 0, "2" => 0, "3" => 23, "4" => 0, "5" => 0, "6" => 0, "7" => 20, "8" => 0, "9" => 0, "10" => 234, "11" => 7654, "12" => 2311 + 2013 => { + 1 => 0, 2 => 0, 3 => 23, 4 => 0, 5 => 0, 6 => 0, 7 => 20, 8 => 0, 9 => 0, 10 => 234, 11 => 7654, 12 => 2311 }, - "2014" => { - "1" => 39383, "2" => 239, "3" => 40273, "4" => 3232, "5" => 2, "6" => 58734, "7" => 11236, "8" => 23, "9" => 867, "10" => 232, "11" => 1111, "12" => 8 + 2014 => { + 1 => 39383, 2 => 239, 3 => 40273, 4 => 3232, 5 => 2, 6 => 58734, 7 => 11236, 8 => 23, 9 => 867, 10 => 232, 11 => 1111, 12 => 8 }, - "2015" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 710 + 2015 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 710 }, - "2016" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 520, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 720 + 2016 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 520, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 720 }, - "2017" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 220, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 170, "11" => 750, "12" => 73 + 2017 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 220, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 170, 11 => 750, 12 => 73 }, - "2018" => { - "1" => 2000, "2" => 220, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 120, "11" => 750, "12" => 60 + 2018 => { + 1 => 2000, 2 => 220, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 120, 11 => 750, 12 => 60 }, - "2019" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 70 + 2019 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 70 }, - "2020" => { - "1" => 2000, "2" => 210, "3" => 640, "4" => 540, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 790 + 2020 => { + 1 => 2000, 2 => 210, 3 => 640, 4 => 540, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 790 }, - "2021" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 550, "5" => 270, "6" => 980, "7" => 340, "8" => 320, "9" => 630, "10" => 110, "11" => 750, "12" => 70 + 2021 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 550, 5 => 270, 6 => 980, 7 => 340, 8 => 320, 9 => 630, 10 => 110, 11 => 750, 12 => 70 }, - "2022" => { - "1" => 2000, "2" => 230, "3" => 640, "4" => 540, "5" => 270, "6" => 990, "7" => 340, "8" => 320, "9" => 610, "10" => 180, "11" => 750, "12" => 30 + 2022 => { + 1 => 2000, 2 => 230, 3 => 640, 4 => 540, 5 => 270, 6 => 990, 7 => 340, 8 => 320, 9 => 610, 10 => 180, 11 => 750, 12 => 30 } } } @@ -214,38 +214,38 @@ def before_suite "SNOMEDCT" => "SNOMEDCT Ontology", "TST" => "TST Ontology" } - self.class._delete - self.class._create_user - self.class._create_onts + _delete + _create_user + _create_onts end def teardown - self.class._delete_onts - self.class._create_onts + self._delete_onts + self._create_onts end - def self._create_user + def _create_user username = "tim" test_user = LinkedData::Models::User.new(username: username, email: "#{username}@example.org", password: "password") test_user.save if test_user.valid? @@user = test_user.valid? ? test_user : LinkedData::Models::User.find(username).first end - def self._create_onts + def _create_onts @@onts.each do |acronym, name| ont = LinkedData::Models::Ontology.new(acronym: acronym, name: name, administeredBy: [@@user]) ont.save end end - def self._delete_onts + def _delete_onts @@onts.each do |acronym, _| ont = LinkedData::Models::Ontology.find(acronym).first ont.delete unless ont.nil? end end - def self._delete + def _delete _delete_onts test_user = LinkedData::Models::User.find("tim").first test_user.delete unless test_user.nil? diff --git a/test/controllers/test_ontology_submissions_controller.rb b/test/controllers/test_ontology_submissions_controller.rb index 297309e1..670658a7 100644 --- a/test/controllers/test_ontology_submissions_controller.rb +++ b/test/controllers/test_ontology_submissions_controller.rb @@ -217,7 +217,7 @@ def test_ontology_submissions_access_controller allowed_user.save blocked_user = User.new({ username: "blocked", - email: "test@example.org", + email: "test1254@example.org", password: "12345" }) blocked_user.save @@ -374,7 +374,7 @@ def test_submissions_pagination_filter assert last_response.ok? submissions = MultiJson.load(last_response.body) refute_empty submissions["collection"] - assert_equal ontologies.map{|x| x.latest_submission(status: :any).bring(:creationDate).creationDate}.sort.map(&:to_s), submissions["collection"].map{|x| x["creationDate"]}.reverse + assert_equal ontologies.map{|x| x.latest_submission(status: :any).bring(:creationDate).creationDate}.sort, submissions["collection"].map{|x| DateTime.parse(x["creationDate"])}.reverse # test search with format get "/submissions?page=1&pagesize=100&acronym=tes&name=tes&hasOntologyLanguage=SKOS" diff --git a/test/controllers/test_schemes_controller.rb b/test/controllers/test_schemes_controller.rb index d4504aa3..b8c6893f 100644 --- a/test/controllers/test_schemes_controller.rb +++ b/test/controllers/test_schemes_controller.rb @@ -2,7 +2,7 @@ class TestSchemesController < TestCase - def self.before_suite + def before_suite LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, acronym: 'INRAETHES', @@ -13,7 +13,7 @@ def self.before_suite }) end - def self.after_suite + def after_suite LinkedData::SampleData::Ontology.delete_ontologies_and_submissions end diff --git a/test/controllers/test_search_models_controller.rb b/test/controllers/test_search_models_controller.rb index 233c7bc4..0585318d 100644 --- a/test/controllers/test_search_models_controller.rb +++ b/test/controllers/test_search_models_controller.rb @@ -2,7 +2,7 @@ class TestSearchModelsController < TestCase - def self.after_suite + def after_suite LinkedData::SampleData::Ontology.delete_ontologies_and_submissions LinkedData::Models::Ontology.indexClear LinkedData::Models::Agent.indexClear @@ -12,7 +12,7 @@ def self.after_suite end def setup - self.class.after_suite + after_suite end def test_show_all_collection diff --git a/test/controllers/test_skos_xl_label_controller.rb b/test/controllers/test_skos_xl_label_controller.rb index 4c929e2d..e848f294 100644 --- a/test/controllers/test_skos_xl_label_controller.rb +++ b/test/controllers/test_skos_xl_label_controller.rb @@ -2,7 +2,7 @@ class TestSkosXlLabelController < TestCase - def self.before_suite + def before_suite LinkedData::SampleData::Ontology.create_ontologies_and_submissions({ process_submission: true, acronym: 'INRAETHES', @@ -18,7 +18,7 @@ def self.before_suite sub.save end - def self.after_suite + def after_suite LinkedData::SampleData::Ontology.delete_ontologies_and_submissions end