From 6db30394557fafa6dba50c97aa563b5f4f7a5fc8 Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Mon, 15 Jul 2019 09:38:41 -0400 Subject: [PATCH 01/65] added omit statuses to some initial files --- lib/app/sequence_base.rb | 3 +++ lib/app/utils/exceptions.rb | 7 +++++++ lib/app/utils/result_statuses.rb | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/app/sequence_base.rb b/lib/app/sequence_base.rb index 43f21570b..29d6aee8e 100644 --- a/lib/app/sequence_base.rb +++ b/lib/app/sequence_base.rb @@ -412,6 +412,9 @@ def self.test(name, &block) result.skip! result.message = e.message result.details = e.details + rescue OmitException => e + result.omit! + result.message = e.message rescue StandardError => e Inferno.logger.error "Fatal Error: #{e.message}" Inferno.logger.error e.backtrace diff --git a/lib/app/utils/exceptions.rb b/lib/app/utils/exceptions.rb index 79c02a92c..2c9b047ae 100644 --- a/lib/app/utils/exceptions.rb +++ b/lib/app/utils/exceptions.rb @@ -33,6 +33,13 @@ def initialize(message = '') end end + class OmitException < RuntimeError + def initialize(message = '') + super(message) + Inferno.logger.info "OmitException: #{message}" + end + end + class WaitException < RuntimeError attr_accessor :endpoint def initialize(endpoint) diff --git a/lib/app/utils/result_statuses.rb b/lib/app/utils/result_statuses.rb index 3cb4b64d8..fc577c5ac 100644 --- a/lib/app/utils/result_statuses.rb +++ b/lib/app/utils/result_statuses.rb @@ -9,8 +9,9 @@ module ResultStatuses WAIT = 'wait' TODO = 'todo' PENDING = 'pending' + OMIT = 'omit' - STATUS_LIST = [FAIL, ERROR, PASS, SKIP, WAIT, TODO, PENDING].freeze + STATUS_LIST = [FAIL, ERROR, PASS, SKIP, WAIT, TODO, PENDING, OMIT].freeze def fail? result == FAIL || error? @@ -67,5 +68,10 @@ def todo! def pending! self.result = PENDING end + + def omit! + self.result = OMIT + end + end end From 69d9b0dfb5d5957907b8ef3cbfa11e0ee39ed49c Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Wed, 17 Jul 2019 15:57:23 -0400 Subject: [PATCH 02/65] added omit status to sequence_result, sequence_base (function), and result_statuses. Made skip helper function omit if for tls_disabled instead of pass, updated views to use the media-record icon (a circle) to indicated omission, and updated css that have a class for the omit icon's color --- lib/app/models/sequence_result.rb | 6 +++++- lib/app/sequence_base.rb | 4 ++++ lib/app/utils/result_statuses.rb | 4 ++++ lib/app/utils/skip_helpers.rb | 2 +- lib/app/views/test_list.erb | 4 ++++ lib/app/views/test_result_details.erb | 6 ++++++ public/css/styles.css | 4 ++++ 7 files changed, 28 insertions(+), 2 deletions(-) diff --git a/lib/app/models/sequence_result.rb b/lib/app/models/sequence_result.rb index 453528384..9855b5125 100644 --- a/lib/app/models/sequence_result.rb +++ b/lib/app/models/sequence_result.rb @@ -23,6 +23,7 @@ class SequenceResult property :skip_count, Integer, default: 0 property :optional_passed, Integer, default: 0 property :optional_total, Integer, default: 0 + property :omitted_count, Integer, default: 0 property :app_version, String @@ -49,7 +50,8 @@ def reset! 'error_count', 'skip_count', 'optional_passed', - 'optional_total' + 'optional_total', + 'omitted_count' ].each { |field| send("#{field}=", 0) } end @@ -71,6 +73,8 @@ def update_result_counts else self.optional_passed += 1 end + when ResultStatuses::OMIT + self.omitted_count += 1 when ResultStatuses::TODO self.todo_count += 1 when ResultStatuses::FAIL diff --git a/lib/app/sequence_base.rb b/lib/app/sequence_base.rb index 29d6aee8e..f8913acb7 100644 --- a/lib/app/sequence_base.rb +++ b/lib/app/sequence_base.rb @@ -478,6 +478,10 @@ def pass(message = '') raise PassException, message end + def omit(message = '') + raise OmitException, message + end + def skip(message = '', details = nil) raise SkipException.new message, details end diff --git a/lib/app/utils/result_statuses.rb b/lib/app/utils/result_statuses.rb index fc577c5ac..f0facfcd4 100644 --- a/lib/app/utils/result_statuses.rb +++ b/lib/app/utils/result_statuses.rb @@ -41,6 +41,10 @@ def pending? result == PENDING end + def omit? + result == OMIT + end + def fail! self.result = FAIL end diff --git a/lib/app/utils/skip_helpers.rb b/lib/app/utils/skip_helpers.rb index 52b19a3d9..e6e5c5880 100644 --- a/lib/app/utils/skip_helpers.rb +++ b/lib/app/utils/skip_helpers.rb @@ -8,7 +8,7 @@ def skip_if_not_supported(resource, methods) end def skip_if_tls_disabled - pass 'Test has passed because TLS tests have been disabled by configuration.' if @disable_tls_tests + omit 'Test has beem ommited because TLS tests have been disabled by configuration.' if @disable_tls_tests end def skip_if_url_invalid(url, url_name, details = nil) diff --git a/lib/app/views/test_list.erb b/lib/app/views/test_list.erb index c435131b2..b05f4ef83 100644 --- a/lib/app/views/test_list.erb +++ b/lib/app/views/test_list.erb @@ -36,6 +36,10 @@
+ <% when 'omit' %> +
+ +
<% end %> <% if result.test_warnings.length > 0 %>
diff --git a/lib/app/views/test_result_details.erb b/lib/app/views/test_result_details.erb index 06ab3fe63..548af81cd 100644 --- a/lib/app/views/test_result_details.erb +++ b/lib/app/views/test_result_details.erb @@ -27,7 +27,13 @@
+ <% when 'omit' %> +
+ +
+ <% end %> + <%# TODO: Make this dependent on a flag for community/guided edition %> <% unless @test_result.required %> [OPTIONAL] <% end %> <%= @test_result.test_id + ': ' +@test_result.name %> diff --git a/public/css/styles.css b/public/css/styles.css index b7538e2fc..e2979eb87 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -750,6 +750,10 @@ body { color: #00e1e1; } +.result-details-icon-omit { + color: #999; +} + .result-details-icon-todo { color: #336699; } From a13df2f165facf919993c550d3f8e77ed9fcaa81 Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Wed, 17 Jul 2019 17:48:32 -0400 Subject: [PATCH 03/65] updated count to display how many required tests were omitted --- lib/app/models/sequence_result.rb | 11 ++++++++--- lib/app/views/test_case.erb | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/app/models/sequence_result.rb b/lib/app/models/sequence_result.rb index 9855b5125..419a50000 100644 --- a/lib/app/models/sequence_result.rb +++ b/lib/app/models/sequence_result.rb @@ -23,7 +23,9 @@ class SequenceResult property :skip_count, Integer, default: 0 property :optional_passed, Integer, default: 0 property :optional_total, Integer, default: 0 - property :omitted_count, Integer, default: 0 + + property :required_omitted, Integer, default: 0 + property :omitted_total, Integer, default: 0 property :app_version, String @@ -51,7 +53,7 @@ def reset! 'skip_count', 'optional_passed', 'optional_total', - 'omitted_count' + 'omitted_total' ].each { |field| send("#{field}=", 0) } end @@ -74,7 +76,10 @@ def update_result_counts self.optional_passed += 1 end when ResultStatuses::OMIT - self.omitted_count += 1 + if result.required + self.required_omitted += 1 + end + self.omitted_total += 1 when ResultStatuses::TODO self.todo_count += 1 when ResultStatuses::FAIL diff --git a/lib/app/views/test_case.erb b/lib/app/views/test_case.erb index 4060ebd02..ea9848df1 100644 --- a/lib/app/views/test_case.erb +++ b/lib/app/views/test_case.erb @@ -71,6 +71,7 @@ <%= test_case.sequence.test_count %> tests <% else %> <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].required_total%> Required Tests Passed + <%= sequence_results[test_case.id].required_omitted %> Required Tests Omitted <% if sequence_results[test_case.id].optional_total > 0%> - <%= sequence_results[test_case.id].optional_passed%>/<%= sequence_results[test_case.id].optional_total%> Optional Tests Passed <% end%> From 853b1792d694f1b595d5470bcc7c63f3003171ec Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Thu, 18 Jul 2019 17:56:33 -0400 Subject: [PATCH 04/65] added result.omit as an result status, and fixed bug where elsif sequence_result should have been result --- lib/tasks/tasks.rake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/tasks/tasks.rake b/lib/tasks/tasks.rake index f9263cf69..30f625bed 100644 --- a/lib/tasks/tasks.rake +++ b/lib/tasks/tasks.rake @@ -114,7 +114,7 @@ def execute(instance, sequences) puts " #{req}" end end - elsif sequence_result.error? + elsif result.error? print 'X error'.magenta print " - #{result.test_id} #{result.name}\n" puts " Message: #{result.message}" @@ -123,7 +123,11 @@ def execute(instance, sequences) end fails = true end - end + elsif result.omit? + print '* omit'.light_black + print " - #{result.test_id} #{result.name}\n" + puts " Message: #{result.message}" + end print "\n" + sequence.sequence_name + ' Sequence Result: ' if sequence_result.pass? puts 'pass '.green + checkmark.encode('utf-8').green @@ -150,6 +154,7 @@ def execute(instance, sequences) error_count = sequence_results.count(&:error?).to_s print(', ' + error_count.yellow + ' error') end + puts "\n=============================================\n" return_value = 0 From 3dd00318def97b8d98d5d750530f22d2ac25745b Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Thu, 18 Jul 2019 18:13:52 -0400 Subject: [PATCH 05/65] updated optional message in the view, changed the sequence_result to store optional and required omitted results instead of total, fixed spelling error in skip_helpers method --- lib/app/models/sequence_result.rb | 8 +++++--- lib/app/utils/skip_helpers.rb | 2 +- lib/app/views/test_case.erb | 8 ++++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/app/models/sequence_result.rb b/lib/app/models/sequence_result.rb index 419a50000..11d2c89d1 100644 --- a/lib/app/models/sequence_result.rb +++ b/lib/app/models/sequence_result.rb @@ -25,7 +25,7 @@ class SequenceResult property :optional_total, Integer, default: 0 property :required_omitted, Integer, default: 0 - property :omitted_total, Integer, default: 0 + property :optional_omitted, Integer, default: 0 property :app_version, String @@ -53,7 +53,8 @@ def reset! 'skip_count', 'optional_passed', 'optional_total', - 'omitted_total' + 'required_omitted', + 'optional_omitted' ].each { |field| send("#{field}=", 0) } end @@ -78,8 +79,9 @@ def update_result_counts when ResultStatuses::OMIT if result.required self.required_omitted += 1 + else + self.optional_omitted += 1 end - self.omitted_total += 1 when ResultStatuses::TODO self.todo_count += 1 when ResultStatuses::FAIL diff --git a/lib/app/utils/skip_helpers.rb b/lib/app/utils/skip_helpers.rb index e6e5c5880..ba3394a2b 100644 --- a/lib/app/utils/skip_helpers.rb +++ b/lib/app/utils/skip_helpers.rb @@ -8,7 +8,7 @@ def skip_if_not_supported(resource, methods) end def skip_if_tls_disabled - omit 'Test has beem ommited because TLS tests have been disabled by configuration.' if @disable_tls_tests + omit 'Test has beem omitted because TLS tests have been disabled by configuration.' #if @disable_tls_tests end def skip_if_url_invalid(url, url_name, details = nil) diff --git a/lib/app/views/test_case.erb b/lib/app/views/test_case.erb index ea9848df1..fe3a85c49 100644 --- a/lib/app/views/test_case.erb +++ b/lib/app/views/test_case.erb @@ -70,11 +70,15 @@ <% if sequence_results[test_case.id].nil? %> <%= test_case.sequence.test_count %> tests <% else %> - <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].required_total%> Required Tests Passed - <%= sequence_results[test_case.id].required_omitted %> Required Tests Omitted + <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].required_total - sequence_results[test_case.id].required_omitted %> Required Tests Passed + <% if sequence_results[test_case.id].optional_total > 0%> - <%= sequence_results[test_case.id].optional_passed%>/<%= sequence_results[test_case.id].optional_total%> Optional Tests Passed <% end%> + + <% if sequence_results[test_case.id].required_omitted + sequence_results[test_case.id].optional_omitted > 0%> - + <%= sequence_results[test_case.id].optional_omitted %> Tests Omitted + <% end%> <% end %> -
diff --git a/lib/app/views/guided.erb b/lib/app/views/guided.erb index 1ab37188a..241393c35 100644 --- a/lib/app/views/guided.erb +++ b/lib/app/views/guided.erb @@ -593,13 +593,14 @@ IconMeaningDescription - Pass A test passed - Fail A test failed - Optional Fail An optional test failed - this will not affect the overall count of passed tests - Skip A test was skipped - Warning There is some critical information that you should be aware of - Outgoing HTTP(S) This test contains outgoing HTTP(S) requests - Incoming HTTP(S) This test contains incoming HTTP(S) requests + Pass A test passed + Fail A test failed + Optional Fail An optional test failed - this will not affect the overall count of passed tests + Skip A test was skipped + Omit A test was omitted and does not affect passing or failed scores + Warning There is some critical information that you should be aware of + Outgoing HTTP(S) This test contains outgoing HTTP(S) requests + Incoming HTTP(S) This test contains incoming HTTP(S) requests

For more information, see the Inferno README and the Inferno wiki.

From 3c1561ec8f5df9b76a624cbcdf43a2dc86b6888e Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Mon, 5 Aug 2019 17:40:46 -0400 Subject: [PATCH 38/65] updated report message to match test_case method, and added helper method both use --- lib/app/models/sequence_result.rb | 4 ++++ lib/app/views/report.erb | 6 +++++- lib/app/views/test_case.erb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/app/models/sequence_result.rb b/lib/app/models/sequence_result.rb index 842b639e4..a71324c75 100644 --- a/lib/app/models/sequence_result.rb +++ b/lib/app/models/sequence_result.rb @@ -67,6 +67,10 @@ def total_omitted required_omitted + optional_omitted end + def total_required_tests_except_omitted + required_total - required_omitted + end + def update_result_counts test_results.each do |result| if result.required diff --git a/lib/app/views/report.erb b/lib/app/views/report.erb index 430df283c..509709dfe 100644 --- a/lib/app/views/report.erb +++ b/lib/app/views/report.erb @@ -147,10 +147,14 @@ <% if sequence_results[test_case.id].nil? %> <%= test_case.sequence.test_count %> tests <% else %> - <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].required_total%> Required Tests Passed + <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].total_required_tests_except_omitted%> Required Tests Passed <% if sequence_results[test_case.id].optional_total > 0%> - <%= sequence_results[test_case.id].optional_passed%>/<%= sequence_results[test_case.id].optional_total%> Optional Tests Passed <% end%> + <% if sequence_results[test_case.id].total_omitted.positive?%> - + <%= sequence_results[test_case.id].total_omitted %> Test <% if sequence_results[test_case.id].total_omitted != 1%>s<% end%> Omitted + <% end%> + <% end %>
diff --git a/lib/app/views/test_case.erb b/lib/app/views/test_case.erb index 34cd72c18..4c99d27d1 100644 --- a/lib/app/views/test_case.erb +++ b/lib/app/views/test_case.erb @@ -70,7 +70,7 @@ <% if sequence_results[test_case.id].nil? %> <%= test_case.sequence.test_count %> tests <% else %> - <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].required_total - sequence_results[test_case.id].required_omitted %> Required Tests Passed + <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].calculate_total_required_tests_except_omitted %> Required Tests Passed <% if sequence_results[test_case.id].optional_total > 0%> - <%= sequence_results[test_case.id].optional_passed%>/<%= sequence_results[test_case.id].optional_total%> Optional Tests Passed From 18af86862ecee52ad5d28435eb358f2b50d7244a Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Mon, 5 Aug 2019 17:53:38 -0400 Subject: [PATCH 39/65] fixed method name --- lib/app/views/test_case.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/views/test_case.erb b/lib/app/views/test_case.erb index 4c99d27d1..85638a5b3 100644 --- a/lib/app/views/test_case.erb +++ b/lib/app/views/test_case.erb @@ -70,7 +70,7 @@ <% if sequence_results[test_case.id].nil? %> <%= test_case.sequence.test_count %> tests <% else %> - <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].calculate_total_required_tests_except_omitted %> Required Tests Passed + <%= sequence_results[test_case.id].required_passed %>/<%= sequence_results[test_case.id].total_required_tests_except_omitted %> Required Tests Passed <% if sequence_results[test_case.id].optional_total > 0%> - <%= sequence_results[test_case.id].optional_passed%>/<%= sequence_results[test_case.id].optional_total%> Optional Tests Passed From 88df243241d0fa9a7ebc658b29bc7562cc3bfe97 Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Tue, 6 Aug 2019 12:17:31 -0400 Subject: [PATCH 40/65] removed float-right from css icon class because that depends on where the icon is displayed, and instead moved it to test-list.erb in that instance --- lib/app/views/report.erb | 1 - lib/app/views/test_list.erb | 6 +++--- public/css/styles.css | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/app/views/report.erb b/lib/app/views/report.erb index 509709dfe..f813dcc5f 100644 --- a/lib/app/views/report.erb +++ b/lib/app/views/report.erb @@ -154,7 +154,6 @@ <% if sequence_results[test_case.id].total_omitted.positive?%> - <%= sequence_results[test_case.id].total_omitted %> Test <% if sequence_results[test_case.id].total_omitted != 1%>s<% end%> Omitted <% end%> - <% end %>
diff --git a/lib/app/views/test_list.erb b/lib/app/views/test_list.erb index b05f4ef83..6ce641d89 100644 --- a/lib/app/views/test_list.erb +++ b/lib/app/views/test_list.erb @@ -42,7 +42,7 @@
<% end %> <% if result.test_warnings.length > 0 %> -
+
<% else %> @@ -50,7 +50,7 @@ <% end %> <% unless result.request_responses.find{ |f| f.direction == 'outbound'}.nil? %> -
+
<% else %> @@ -58,7 +58,7 @@ <% end %> <% unless result.request_responses.find{ |f| f.direction == 'inbound'}.nil? %> -
+
<% else %> diff --git a/public/css/styles.css b/public/css/styles.css index e2979eb87..5393c24d0 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -764,12 +764,12 @@ body { .result-details-icon-warning { color: #FF9500; - float: right; + /*float: right;*/ } .result-details-icon-requests { color: #336699; - float: right; + /*float: right;*/ } .result-details-message { From 1c14e01811db73c34f2309059c452de44c696465 Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Tue, 6 Aug 2019 12:20:00 -0400 Subject: [PATCH 41/65] fixed grammar --- lib/app/views/default.erb | 2 +- lib/app/views/guided.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/views/default.erb b/lib/app/views/default.erb index 36859fc5a..8c460aa37 100644 --- a/lib/app/views/default.erb +++ b/lib/app/views/default.erb @@ -429,7 +429,7 @@ Fail A test failed Optional Fail An optional test failed - this will not affect the overall count of passed tests Skip A test was skipped - Omit A test was omitted and does not affect passing or failed scores + Omit A test was omitted and does not affect passed or failed scores Warning There is some critical information that you should be aware of Outgoing HTTP(S) This test contains outgoing HTTP(S) requests Incoming HTTP(S) This test contains incoming HTTP(S) requests diff --git a/lib/app/views/guided.erb b/lib/app/views/guided.erb index 241393c35..112bac458 100644 --- a/lib/app/views/guided.erb +++ b/lib/app/views/guided.erb @@ -597,7 +597,7 @@ Fail A test failed Optional Fail An optional test failed - this will not affect the overall count of passed tests Skip A test was skipped - Omit A test was omitted and does not affect passing or failed scores + Omit A test was omitted and does not affect passed or failed scores Warning There is some critical information that you should be aware of Outgoing HTTP(S) This test contains outgoing HTTP(S) requests Incoming HTTP(S) This test contains incoming HTTP(S) requests From 07c7e5b27d4b8a89442ac3c03e383683bedaae53 Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Tue, 6 Aug 2019 12:24:45 -0400 Subject: [PATCH 42/65] removed unecessary comments --- public/css/styles.css | 2 -- 1 file changed, 2 deletions(-) diff --git a/public/css/styles.css b/public/css/styles.css index 5393c24d0..be7b28330 100644 --- a/public/css/styles.css +++ b/public/css/styles.css @@ -764,12 +764,10 @@ body { .result-details-icon-warning { color: #FF9500; - /*float: right;*/ } .result-details-icon-requests { color: #336699; - /*float: right;*/ } .result-details-message { From 45ceb504044c11950e684463fea0638977fa77cb Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Tue, 6 Aug 2019 18:01:08 -0400 Subject: [PATCH 43/65] removed tooltip on warning icon indicating redirect --- lib/app/views/test_list.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/views/test_list.erb b/lib/app/views/test_list.erb index c435131b2..1c66262d9 100644 --- a/lib/app/views/test_list.erb +++ b/lib/app/views/test_list.erb @@ -39,7 +39,7 @@ <% end %> <% if result.test_warnings.length > 0 %>
- +
<% else %>
From 4e87d8dde7778345da7bc6a47fa62b02fb7b8586 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Tue, 6 Aug 2019 13:49:17 -0400 Subject: [PATCH 44/65] add ServerCapabilities class --- lib/app/models/server_capabilities.rb | 27 +++++++++++++++ lib/app/models/testing_instance.rb | 2 ++ test/model/server_capabilities_test.rb | 48 ++++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 lib/app/models/server_capabilities.rb create mode 100644 test/model/server_capabilities_test.rb diff --git a/lib/app/models/server_capabilities.rb b/lib/app/models/server_capabilities.rb new file mode 100644 index 000000000..32557212e --- /dev/null +++ b/lib/app/models/server_capabilities.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require 'dm-types' + +module Inferno + module Models + class ServerCapabilities + include DataMapper::Resource + property :id, String, key: true, default: proc { SecureRandom.uuid } + property :capabilities, Json, lazy: false # lazy loading Json properties is broken + + belongs_to :testing_instance + + self.raise_on_save_failure = true + + def supported_resources + statement.rest.each_with_object(Set.new) do |rest, resources| + rest.resource.each { |resource| resources << resource.type } + end + end + + def statement + @statement ||= FHIR::CapabilityStatement.new(capabilities) + end + end + end +end diff --git a/lib/app/models/testing_instance.rb b/lib/app/models/testing_instance.rb index e91bb7e93..99bd0f822 100644 --- a/lib/app/models/testing_instance.rb +++ b/lib/app/models/testing_instance.rb @@ -2,6 +2,7 @@ require 'dm-core' require 'dm-migrations' +require_relative 'server_capabilities' require_relative '../utils/result_statuses' module Inferno @@ -57,6 +58,7 @@ class TestingInstance has n, :sequence_results has n, :supported_resources, order: [:index.asc] has n, :resource_references + has 1, :server_capabilities def latest_results sequence_results.each_with_object({}) do |result, hash| diff --git a/test/model/server_capabilities_test.rb b/test/model/server_capabilities_test.rb new file mode 100644 index 000000000..ec9717096 --- /dev/null +++ b/test/model/server_capabilities_test.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +require_relative '../test_helper' +require_relative '../../lib/app/models/server_capabilities' +require_relative '../../lib/app/models/testing_instance' + +class ServerCapabilitiesTest < MiniTest::Test + def setup + @capability_statement = { + rest: [ + { + resource: [ + { + type: 'Patient', + interaction: [ + { code: 'read' }, + { code: 'vread' }, + { code: 'history-instance' }, + { code: 'search' } + ] + }, + { + type: 'Condition', + interaction: [ + { code: 'delete' }, + { code: 'update' } + ] + }, + { + type: 'Observation' + } + ] + } + ] + } + + @capabilities = Inferno::Models::ServerCapabilities.new( + testing_instance_id: Inferno::Models::TestingInstance.create.id, + capabilities: @capability_statement + ) + end + + def test_supported_resources + expected_resources = Set.new(['Patient', 'Condition', 'Observation']) + + assert @capabilities.supported_resources == expected_resources + end +end From 4e50e93a9d66249996a92e083fcb344a1b571d10 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 8 Aug 2019 08:03:22 -0400 Subject: [PATCH 45/65] move module.rb to models --- lib/app/{ => models}/module.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename lib/app/{ => models}/module.rb (100%) diff --git a/lib/app/module.rb b/lib/app/models/module.rb similarity index 100% rename from lib/app/module.rb rename to lib/app/models/module.rb From 984088058fc273d6564f535f3ceb01521ff2859c Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 8 Aug 2019 08:26:06 -0400 Subject: [PATCH 46/65] break up module.rb --- lib/app.rb | 2 +- lib/app/models/module.rb | 150 ++++------------------------ lib/app/models/module/test_case.rb | 31 ++++++ lib/app/models/module/test_group.rb | 54 ++++++++++ lib/app/models/module/test_set.rb | 37 +++++++ test/test_helper.rb | 1 - 6 files changed, 141 insertions(+), 134 deletions(-) create mode 100644 lib/app/models/module/test_case.rb create mode 100644 lib/app/models/module/test_group.rb create mode 100644 lib/app/models/module/test_set.rb diff --git a/lib/app.rb b/lib/app.rb index a3dc3bc27..073b8c1af 100644 --- a/lib/app.rb +++ b/lib/app.rb @@ -21,7 +21,7 @@ require_relative 'app/endpoint' require_relative 'app/utils/secure_random_base62' require_relative 'app/sequence_base' -require_relative 'app/module' +require_relative 'app/models/module' require_relative 'version' require_relative 'app/models' require_relative 'app/utils/terminology' diff --git a/lib/app/models/module.rb b/lib/app/models/module.rb index 9d9bcbb56..36108356f 100644 --- a/lib/app/models/module.rb +++ b/lib/app/models/module.rb @@ -2,139 +2,31 @@ require 'yaml' +require_relative 'module/test_group' +require_relative 'module/test_set' + module Inferno class Module @@modules = {} - class TestSet - attr_accessor :id - attr_accessor :view - attr_accessor :groups - - def initialize(id, view) - @id = id - @view = view - @groups = [] - end - - def sequences - @groups.flat_map { |group| group.test_cases.map(&:sequence) } - end - - def test_cases - @groups.flat_map(&:test_cases) - end - - def test_case_by_id(test_case_id) - test_cases.find { |tc| tc.id == test_case_id } - end - - def variable_required_by(variable) - sequences.select { |sequence| sequence.requires.include? variable } - end - - def variable_defined_by(variable) - sequences.select { |sequence| sequence.defines.include? variable } - end - end - - class TestGroup - attr_accessor :test_set - attr_accessor :name - attr_accessor :overview - attr_accessor :input_instructions - attr_accessor :lock_variables - attr_accessor :id - attr_accessor :test_cases - attr_accessor :run_all - attr_accessor :run_skipped - - def initialize(test_set, name, overview, input_instructions, lock_variables, run_all, run_skipped) - @test_set = test_set - @name = name - @id = name.gsub(/[^0-9a-z]/i, '') - @overview = overview - @run_all = run_all - @test_cases = [] - @test_case_names = {} - @input_instructions = input_instructions - @lock_variables = lock_variables || [] - @run_skipped = run_skipped - end - - def add_test_case(sequence_name, parameters = {}) - current_name = "#{test_set.id}_#{@id}_#{sequence_name}" - index = 1 - while @test_case_names.key?(current_name) - index += 1 - current_name = "#{test_set.id}_#{@id}_#{sequence_name}_#{index}" - raise 'Too many test cases using the same scenario' if index > 99 - end - - @test_case_names[current_name] = true - - sequence = Inferno::Sequence::SequenceBase.descendants.find { |seq| seq.sequence_name == sequence_name } - - raise "No such sequence: #{sequence_name}" if sequence.nil? - - new_test_case = TestCase.new(current_name, self, sequence, parameters) - - @test_cases << new_test_case - - new_test_case - end - end - - class TestCase - attr_accessor :id - attr_accessor :test_group - attr_accessor :sequence - attr_accessor :parameters - - def initialize(id, test_group, sequence, parameters) - @id = id - @sequence = sequence - @test_group = test_group - @parameters = parameters - end - - def title - if !@parameters[:title].nil? - @parameters[:title] - else - sequence.title - end - end - - def description - if !@parameters[:description].nil? - @parameters[:description] - else - sequence.description - end - end - - def variable_defaults - @parameters[:variable_defaults] - end - end - - attr_accessor :name - attr_accessor :title - attr_accessor :hide_optional - attr_accessor :description attr_accessor :default_test_set + attr_accessor :description attr_accessor :fhir_version + attr_accessor :hide_optional + attr_accessor :name + attr_accessor :resources attr_accessor :test_sets + attr_accessor :title - def initialize(name, description, default_test_set, fhir_version, title) - @name = name - @description = description - @default_test_set = default_test_set - @fhir_version = fhir_version + def initialize(**params) + @name = params[:name] + @description = params[:description] + @default_test_set = params[:default_test_set] + @fhir_version = params[:fhir_version] @test_sets = {} - @title = title - @hide_optional = hide_optional + @title = params[:title] || params[:name] + @hide_optional = params[:hide_optional] + @resources = Set.new(params[:resources]) end def sequences @@ -166,13 +58,7 @@ def self.available_modules end def self.load_module(module_hash) - new_module = new( - module_hash[:name], - module_hash[:description], - module_hash[:default_test_set], - module_hash[:fhir_version], - module_hash[:title] || module_hash[:name] - ) + new_module = new(module_hash) module_hash[:test_sets].each do |test_set_key, test_set| new_module.default_test_set ||= test_set_key.to_s @@ -205,7 +91,7 @@ def self.load_module(module_hash) @@modules[module_hash[:name]] = new_module end - Dir.glob(File.join(__dir__, 'modules', '*_module.yml')).each do |file| + Dir.glob(File.join(__dir__, '..', 'modules', '*_module.yml')).each do |file| this_module = YAML.load_file(file).deep_symbolize_keys load_module(this_module) end diff --git a/lib/app/models/module/test_case.rb b/lib/app/models/module/test_case.rb new file mode 100644 index 000000000..04281e09c --- /dev/null +++ b/lib/app/models/module/test_case.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +module Inferno + class Module + class TestCase + attr_accessor :id + attr_accessor :test_group + attr_accessor :sequence + attr_accessor :parameters + + def initialize(id, test_group, sequence, parameters) + @id = id + @sequence = sequence + @test_group = test_group + @parameters = parameters + end + + def title + @parameters[:title] || sequence.title + end + + def description + @parameters[:description] || sequence.description + end + + def variable_defaults + @parameters[:variable_defaults] + end + end + end +end diff --git a/lib/app/models/module/test_group.rb b/lib/app/models/module/test_group.rb new file mode 100644 index 000000000..560648066 --- /dev/null +++ b/lib/app/models/module/test_group.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +require_relative 'test_case' + +module Inferno + class Module + class TestGroup + attr_accessor :test_set + attr_accessor :name + attr_accessor :overview + attr_accessor :input_instructions + attr_accessor :lock_variables + attr_accessor :id + attr_accessor :test_cases + attr_accessor :run_all + attr_accessor :run_skipped + + def initialize(test_set, name, overview, input_instructions, lock_variables, run_all, run_skipped) + @test_set = test_set + @name = name + @id = name.gsub(/[^0-9a-z]/i, '') + @overview = overview + @run_all = run_all + @test_cases = [] + @test_case_names = {} + @input_instructions = input_instructions + @lock_variables = lock_variables || [] + @run_skipped = run_skipped + end + + def add_test_case(sequence_name, parameters = {}) + current_name = "#{test_set.id}_#{@id}_#{sequence_name}" + index = 1 + while @test_case_names.key?(current_name) + index += 1 + current_name = "#{test_set.id}_#{@id}_#{sequence_name}_#{index}" + raise 'Too many test cases using the same scenario' if index > 99 + end + + @test_case_names[current_name] = true + + sequence = Inferno::Sequence::SequenceBase.descendants.find { |seq| seq.sequence_name == sequence_name } + + raise "No such sequence: #{sequence_name}" if sequence.nil? + + new_test_case = TestCase.new(current_name, self, sequence, parameters) + + @test_cases << new_test_case + + new_test_case + end + end + end +end diff --git a/lib/app/models/module/test_set.rb b/lib/app/models/module/test_set.rb new file mode 100644 index 000000000..37d40b146 --- /dev/null +++ b/lib/app/models/module/test_set.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +module Inferno + class Module + class TestSet + attr_accessor :id + attr_accessor :view + attr_accessor :groups + + def initialize(id, view) + @id = id + @view = view + @groups = [] + end + + def sequences + @groups.flat_map { |group| group.test_cases.map(&:sequence) } + end + + def test_cases + @groups.flat_map(&:test_cases) + end + + def test_case_by_id(test_case_id) + test_cases.find { |tc| tc.id == test_case_id } + end + + def variable_required_by(variable) + sequences.select { |sequence| sequence.requires.include? variable } + end + + def variable_defined_by(variable) + sequences.select { |sequence| sequence.defines.include? variable } + end + end + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index 34fdaee8c..58c3c8528 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -14,7 +14,6 @@ test_log_filename = File.join('tmp', 'test.log') FileUtils.rm test_log_filename if File.exist? test_log_filename -# require File.expand_path '../../app.rb', __FILE__ require_relative '../lib/app' def load_json_fixture(file) From 5d65d380fe40c6e85d1dadefcbf12bd994fd43d8 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 8 Aug 2019 10:06:37 -0400 Subject: [PATCH 47/65] minor module refactors --- lib/app/models/module.rb | 63 ++++++++++------------------- lib/app/models/module/test_case.rb | 6 +-- lib/app/models/module/test_group.rb | 39 ++++++++++++------ lib/app/models/module/test_set.rb | 12 +++--- 4 files changed, 57 insertions(+), 63 deletions(-) diff --git a/lib/app/models/module.rb b/lib/app/models/module.rb index 36108356f..409ec614c 100644 --- a/lib/app/models/module.rb +++ b/lib/app/models/module.rb @@ -7,7 +7,7 @@ module Inferno class Module - @@modules = {} + @modules = {} attr_accessor :default_test_set attr_accessor :description @@ -18,23 +18,32 @@ class Module attr_accessor :test_sets attr_accessor :title - def initialize(**params) + def initialize(params) @name = params[:name] @description = params[:description] @default_test_set = params[:default_test_set] @fhir_version = params[:fhir_version] - @test_sets = {} @title = params[:title] || params[:name] @hide_optional = params[:hide_optional] @resources = Set.new(params[:resources]) + @test_sets = {}.tap do |test_sets| + params[:test_sets].each do |test_set_key, test_set| + self.default_test_set ||= test_set_key.to_s + test_sets[test_set_key] = TestSet.new(test_set_key, test_set) + end + end + + Module.add(name, self) end def sequences - @test_sets.values.flat_map { |test_set| test_set.groups.flat_map { |group| group.test_cases.map(&:sequence) } } + test_sets.values.flat_map do |test_set| + test_set.groups.flat_map { |group| group.test_cases.map(&:sequence) } + end end def view_by_test_set(test_set) - @test_sets[test_set.to_sym].view.to_sym + test_sets[test_set.to_sym].view.to_sym end def sequence_by_name(sequence_name) @@ -49,51 +58,21 @@ def variable_defined_by(variable) sequences.select { |sequence| sequence.defines.include? variable } end - def self.get(inferno_module) - @@modules[inferno_module] + def self.add(name, inferno_module) + @modules[name] = inferno_module end - def self.available_modules - @@modules + def self.get(inferno_module) + @modules[inferno_module] end - def self.load_module(module_hash) - new_module = new(module_hash) - - module_hash[:test_sets].each do |test_set_key, test_set| - new_module.default_test_set ||= test_set_key.to_s - new_test_set = TestSet.new(test_set_key, test_set[:view]) - test_set[:tests].each do |group| - new_group = TestGroup.new( - new_test_set, - group[:name], - group[:overview], - group[:input_instructions], - group[:lock_variables], - group[:run_all] || false, - group[:run_skipped] || false - ) - - group[:sequences].each do |sequence| - if sequence.instance_of?(String) - new_group.add_test_case(sequence) - else - new_group.add_test_case(sequence[:sequence], sequence) - end - end - - new_test_set.groups << new_group - end - - new_module.test_sets[test_set_key] = new_test_set - end - - @@modules[module_hash[:name]] = new_module + def self.available_modules + @modules end Dir.glob(File.join(__dir__, '..', 'modules', '*_module.yml')).each do |file| this_module = YAML.load_file(file).deep_symbolize_keys - load_module(this_module) + new(this_module) end end end diff --git a/lib/app/models/module/test_case.rb b/lib/app/models/module/test_case.rb index 04281e09c..443d213b4 100644 --- a/lib/app/models/module/test_case.rb +++ b/lib/app/models/module/test_case.rb @@ -16,15 +16,15 @@ def initialize(id, test_group, sequence, parameters) end def title - @parameters[:title] || sequence.title + parameters[:title] || sequence.title end def description - @parameters[:description] || sequence.description + parameters[:description] || sequence.description end def variable_defaults - @parameters[:variable_defaults] + parameters[:variable_defaults] end end end diff --git a/lib/app/models/module/test_group.rb b/lib/app/models/module/test_group.rb index 560648066..47f5db3c7 100644 --- a/lib/app/models/module/test_group.rb +++ b/lib/app/models/module/test_group.rb @@ -14,30 +14,39 @@ class TestGroup attr_accessor :test_cases attr_accessor :run_all attr_accessor :run_skipped + attr_accessor :test_case_names - def initialize(test_set, name, overview, input_instructions, lock_variables, run_all, run_skipped) + def initialize(test_set, group) @test_set = test_set - @name = name + @name = group[:name] @id = name.gsub(/[^0-9a-z]/i, '') - @overview = overview - @run_all = run_all + @overview = group[:overview] + @run_all = group[:run_all] || false @test_cases = [] - @test_case_names = {} - @input_instructions = input_instructions - @lock_variables = lock_variables || [] - @run_skipped = run_skipped + @test_case_names = Set.new + @input_instructions = group[:input_instructions] + @lock_variables = group[:lock_variables] || [] + @run_skipped = group[:run_skipped] || false + + group[:sequences].each do |sequence| + if sequence.instance_of?(String) + add_test_case(sequence) + else + add_test_case(sequence[:sequence], sequence) + end + end end def add_test_case(sequence_name, parameters = {}) - current_name = "#{test_set.id}_#{@id}_#{sequence_name}" + current_name = "#{test_set.id}_#{id}_#{sequence_name}" index = 1 - while @test_case_names.key?(current_name) + while test_case_names.include? current_name index += 1 - current_name = "#{test_set.id}_#{@id}_#{sequence_name}_#{index}" + current_name = "#{test_set.id}_#{id}_#{sequence_name}_#{index}" raise 'Too many test cases using the same scenario' if index > 99 end - @test_case_names[current_name] = true + test_case_names << current_name sequence = Inferno::Sequence::SequenceBase.descendants.find { |seq| seq.sequence_name == sequence_name } @@ -45,10 +54,14 @@ def add_test_case(sequence_name, parameters = {}) new_test_case = TestCase.new(current_name, self, sequence, parameters) - @test_cases << new_test_case + test_cases << new_test_case new_test_case end + + def sequences + test_cases.flat_map(&:sequence) + end end end end diff --git a/lib/app/models/module/test_set.rb b/lib/app/models/module/test_set.rb index 37d40b146..0345b63af 100644 --- a/lib/app/models/module/test_set.rb +++ b/lib/app/models/module/test_set.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require_relative 'test_group' + module Inferno class Module class TestSet @@ -7,18 +9,18 @@ class TestSet attr_accessor :view attr_accessor :groups - def initialize(id, view) + def initialize(id, test_set) @id = id - @view = view - @groups = [] + @view = test_set[:view] + @groups = test_set[:tests].map { |group| TestGroup.new(self, group) } end def sequences - @groups.flat_map { |group| group.test_cases.map(&:sequence) } + groups.flat_map(&:sequences) end def test_cases - @groups.flat_map(&:test_cases) + groups.flat_map(&:test_cases) end def test_case_by_id(test_case_id) From 2f8e1ae7a35e19c251a5486e5d43a8bc5c4f82ba Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 8 Aug 2019 12:07:32 -0400 Subject: [PATCH 48/65] update resources supported display in report --- lib/app/endpoint/test_set_endpoints.rb | 3 ++- lib/app/models/module.rb | 6 ++++-- lib/app/models/server_capabilities.rb | 2 ++ lib/app/models/testing_instance.rb | 4 ++++ lib/app/modules/argonaut/argonaut_conformance_sequence.rb | 4 ++++ .../us_core_r4/us_core_r4_capability_statement_sequence.rb | 4 ++++ lib/app/sequence_base.rb | 4 ++++ lib/app/views/report.erb | 4 ++-- 8 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lib/app/endpoint/test_set_endpoints.rb b/lib/app/endpoint/test_set_endpoints.rb index 05d7d38d4..b513e38fb 100644 --- a/lib/app/endpoint/test_set_endpoints.rb +++ b/lib/app/endpoint/test_set_endpoints.rb @@ -42,7 +42,8 @@ def self.included(klass) fhir_version: instance.fhir_version, app_version: VERSION, resource_references: instance.resource_references.count, - supported_resources: instance.supported_resources.count, + resources_tested: instance.module.resources_to_test.length, + supported_resources: instance.testable_resources.empty? ? '?' : instance.testable_resources.length, request_response: request_response_count, latest_sequence_time: latest_sequence_time, final_result: instance.final_result(params[:test_set_id]), diff --git a/lib/app/models/module.rb b/lib/app/models/module.rb index 409ec614c..36eec30c6 100644 --- a/lib/app/models/module.rb +++ b/lib/app/models/module.rb @@ -14,7 +14,6 @@ class Module attr_accessor :fhir_version attr_accessor :hide_optional attr_accessor :name - attr_accessor :resources attr_accessor :test_sets attr_accessor :title @@ -25,7 +24,6 @@ def initialize(params) @fhir_version = params[:fhir_version] @title = params[:title] || params[:name] @hide_optional = params[:hide_optional] - @resources = Set.new(params[:resources]) @test_sets = {}.tap do |test_sets| params[:test_sets].each do |test_set_key, test_set| self.default_test_set ||= test_set_key.to_s @@ -58,6 +56,10 @@ def variable_defined_by(variable) sequences.select { |sequence| sequence.defines.include? variable } end + def resources_to_test + @resources_to_test ||= Set.new(sequences.flat_map(&:resources_to_test)) + end + def self.add(name, inferno_module) @modules[name] = inferno_module end diff --git a/lib/app/models/server_capabilities.rb b/lib/app/models/server_capabilities.rb index 32557212e..80fc49596 100644 --- a/lib/app/models/server_capabilities.rb +++ b/lib/app/models/server_capabilities.rb @@ -19,6 +19,8 @@ def supported_resources end end + private + def statement @statement ||= FHIR::CapabilityStatement.new(capabilities) end diff --git a/lib/app/models/testing_instance.rb b/lib/app/models/testing_instance.rb index 99bd0f822..12ecd3734 100644 --- a/lib/app/models/testing_instance.rb +++ b/lib/app/models/testing_instance.rb @@ -161,6 +161,10 @@ def patient_id=(patient_id) reload end + def testable_resources + self.module.resources_to_test & (server_capabilities&.supported_resources || Set.new) + end + def save_supported_resources(conformance) resources = ['Patient', 'AllergyIntolerance', diff --git a/lib/app/modules/argonaut/argonaut_conformance_sequence.rb b/lib/app/modules/argonaut/argonaut_conformance_sequence.rb index 8e8b5a265..c5455d9ee 100644 --- a/lib/app/modules/argonaut/argonaut_conformance_sequence.rb +++ b/lib/app/modules/argonaut/argonaut_conformance_sequence.rb @@ -144,6 +144,10 @@ class ArgonautConformanceSequence < CapabilityStatementSequence begin @instance.save_supported_resources(@conformance) + Inferno::Models::ServerCapabilities.create( + testing_instance_id: @instance.id, + capabilities: @conformance.as_json + ) rescue StandardError assert false, 'Conformance Statement could not be parsed.' end diff --git a/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb b/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb index c9b100d80..90fb39bfb 100644 --- a/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb +++ b/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb @@ -144,6 +144,10 @@ class UsCoreR4CapabilityStatementSequence < CapabilityStatementSequence begin @instance.save_supported_resources(@conformance) + Inferno::Models::ServerCapabilities.create( + testing_instance_id: @instance.id, + capabilities: @conformance.as_json + ) rescue StandardError assert false, 'Capability Statement could not be parsed.' end diff --git a/lib/app/sequence_base.rb b/lib/app/sequence_base.rb index d15bf9bb0..8791a4f58 100644 --- a/lib/app/sequence_base.rb +++ b/lib/app/sequence_base.rb @@ -255,6 +255,10 @@ def self.conformance_supports(*supports) @@conformance_supports[sequence_name] || [] end + def self.resources_to_test + conformance_supports.map(&:to_s) + end + def self.versions(*versions) @@versions[sequence_name] = versions unless versions.empty? @@versions[sequence_name] || FHIR::VERSIONS diff --git a/lib/app/views/report.erb b/lib/app/views/report.erb index 430df283c..1e6236fd4 100644 --- a/lib/app/views/report.erb +++ b/lib/app/views/report.erb @@ -41,10 +41,10 @@
- <%=report_summary[:supported_resources]%> + <%=report_summary[:supported_resources]%> / <%=report_summary[:resources_tested]%>
- Supported References + Supported Resources
From bc5b320258d46a6d0a79b131ae85d10b1dfcd379 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 8 Aug 2019 12:37:09 -0400 Subject: [PATCH 49/65] update resource support display in state modal --- lib/app/models/server_capabilities.rb | 25 +++++++++++++++++++++++-- lib/app/models/testing_instance.rb | 9 +++++++++ lib/app/views/state_status.erb | 13 ++++++------- 3 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/app/models/server_capabilities.rb b/lib/app/models/server_capabilities.rb index 80fc49596..cfa01e894 100644 --- a/lib/app/models/server_capabilities.rb +++ b/lib/app/models/server_capabilities.rb @@ -11,19 +11,40 @@ class ServerCapabilities belongs_to :testing_instance - self.raise_on_save_failure = true - def supported_resources statement.rest.each_with_object(Set.new) do |rest, resources| rest.resource.each { |resource| resources << resource.type } end end + def supported_interactions + statement.rest.flat_map do |rest| + rest.resource.map do |resource| + { + resource_type: resource.type, + interactions: resource_interactions(resource).sort + } + end + end + end + private def statement @statement ||= FHIR::CapabilityStatement.new(capabilities) end + + def interaction_display(interaction) + if interaction.code == 'search-type' + 'search' + else + interaction.code + end + end + + def resource_interactions(resource) + resource.interaction.map { |interaction| interaction_display(interaction) } + end end end end diff --git a/lib/app/models/testing_instance.rb b/lib/app/models/testing_instance.rb index 12ecd3734..d6edb1d0b 100644 --- a/lib/app/models/testing_instance.rb +++ b/lib/app/models/testing_instance.rb @@ -219,6 +219,15 @@ def save_supported_resources(conformance) save! end + def supported_resource_interactions + return [] if server_capabilities.blank? + + resources = testable_resources + server_capabilities.supported_interactions.select do |interactions| + resources.include? interactions[:resource_type] + end + end + def conformance_supported?(resource, methods = []) resource_support = supported_resources.find { |r| r.resource_type == resource.to_s } return false if resource_support.nil? || !resource_support.supported diff --git a/lib/app/views/state_status.erb b/lib/app/views/state_status.erb index e6d206558..d235ca195 100644 --- a/lib/app/views/state_status.erb +++ b/lib/app/views/state_status.erb @@ -17,14 +17,13 @@ <% end %>

Conformance Statement Resource Support

- <% if instance.supported_resources.count > 0%> + <% if instance.server_capabilities.present? %>
    - <% instance.supported_resources.each do |resource| %> - <% if resource.supported %> -
  • <%= resource.resource_type %> - <%= "[ #{resource.supported_interactions.join(', ')} ]" unless resource.supported_interactions.nil?%> -
  • - <% end %> + <% instance.supported_resource_interactions.each do |resource| %> +
  • + <%= resource[:resource_type] %> + <%= "[ #{resource[:interactions].join(', ')} ]" unless resource[:interactions].blank?%> +
  • <% end %>
<% else %> From 7e9b7e372ac632a8be0b01b7926d75d0380e5318 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 8 Aug 2019 13:48:40 -0400 Subject: [PATCH 50/65] update TestingInstance#conformance_supported? --- lib/app/models/testing_instance.rb | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lib/app/models/testing_instance.rb b/lib/app/models/testing_instance.rb index d6edb1d0b..0a00fbdc0 100644 --- a/lib/app/models/testing_instance.rb +++ b/lib/app/models/testing_instance.rb @@ -229,22 +229,20 @@ def supported_resource_interactions end def conformance_supported?(resource, methods = []) - resource_support = supported_resources.find { |r| r.resource_type == resource.to_s } - return false if resource_support.nil? || !resource_support.supported + resource_support = supported_resource_interactions.find do |interactions| + interactions[:resource_type] == resource.to_s + end + + return false if resource_support.blank? methods.all? do |method| - case method - when :read - resource_support.read_supported - when :search - resource_support.search_supported - when :history - resource_support.history_supported - when :vread - resource_support.vread_supported + if method == :history + method = 'history-instance' else - false + method = method.to_s end + + resource_support[:interactions].include? method end end From 00cc02b8b1a01b46f797b274fe8cbe0a02f2025a Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Mon, 12 Aug 2019 07:52:16 -0400 Subject: [PATCH 51/65] refactor resource support in tests --- ...onaut_allergy_intolerance_sequence_test.rb | 11 +-------- .../argonaut_careplan_sequence_test.rb | 13 +---------- .../argonaut_careteam_sequence_test.rb | 13 +---------- .../argonaut_condition_sequence_test.rb | 11 +-------- .../argonaut/argonaut_device_sequence_test.rb | 11 +-------- ...rgonaut_diagnostic_report_sequence_test.rb | 11 +-------- .../argonaut/argonaut_goal_sequence_test.rb | 11 +-------- .../argonaut_immunization_sequence_test.rb | 11 +-------- ...argonaut_medication_order_sequence_test.rb | 11 +-------- ...naut_medication_statement_sequence_test.rb | 11 +-------- .../argonaut_observation_sequence_test.rb | 11 +-------- ...rgonaut_patient_read_only_sequence_test.rb | 11 +-------- .../argonaut_patient_search_sequence_test.rb | 11 +-------- .../argonaut_procedure_sequence_test.rb | 11 +-------- .../argonaut_smoking_status_sequence_test.rb | 11 +-------- ...t_vital_signs_observation_sequence_test.rb | 11 +-------- .../medication_order_sequence_test.rb | 10 +------- .../medication_statement_sequence_test.rb | 11 +-------- .../onc_program_document_reference_test.rb | 11 +-------- .../onc_program_provenance_test.rb | 11 +-------- test/sequence/r4_provenance_sequence_test.rb | 7 +----- .../us_core_r4/clinicalnotes_sequence_test.rb | 7 +----- test/test_helper.rb | 23 +++++++++++++++++++ 23 files changed, 45 insertions(+), 215 deletions(-) diff --git a/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb b/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb index 0bf6b2087..464571c8a 100644 --- a/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb @@ -30,16 +30,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_careplan_sequence_test.rb b/test/sequence/argonaut/argonaut_careplan_sequence_test.rb index 9a8efbf02..5403a6c00 100644 --- a/test/sequence/argonaut/argonaut_careplan_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_careplan_sequence_test.rb @@ -30,18 +30,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - if @instance.resource_references.none? { |r| r.resource_type == @resource_type } - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) - end + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_careteam_sequence_test.rb b/test/sequence/argonaut/argonaut_careteam_sequence_test.rb index 511c04533..f5c3252fa 100644 --- a/test/sequence/argonaut/argonaut_careteam_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_careteam_sequence_test.rb @@ -30,18 +30,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - if @instance.resource_references.none? { |r| r.resource_type == @resource_type } - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) - end + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_condition_sequence_test.rb b/test/sequence/argonaut/argonaut_condition_sequence_test.rb index 657553b2e..5f6782156 100644 --- a/test/sequence/argonaut/argonaut_condition_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_condition_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_device_sequence_test.rb b/test/sequence/argonaut/argonaut_device_sequence_test.rb index 71d99deb3..2683e0c4d 100644 --- a/test/sequence/argonaut/argonaut_device_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_device_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb b/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb index c4fd64f65..3b1b361f6 100644 --- a/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb @@ -32,16 +32,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_goal_sequence_test.rb b/test/sequence/argonaut/argonaut_goal_sequence_test.rb index 6d09bdcad..c7e212b1c 100644 --- a/test/sequence/argonaut/argonaut_goal_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_goal_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_immunization_sequence_test.rb b/test/sequence/argonaut/argonaut_immunization_sequence_test.rb index 3f65bb03c..8f5cc3b43 100644 --- a/test/sequence/argonaut/argonaut_immunization_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_immunization_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb b/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb index d9c76bd26..9c5a45963 100644 --- a/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb @@ -32,16 +32,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb b/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb index 523ef58ed..d870eb472 100644 --- a/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb @@ -32,16 +32,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_observation_sequence_test.rb b/test/sequence/argonaut/argonaut_observation_sequence_test.rb index 7f973b6fa..9d2804149 100644 --- a/test/sequence/argonaut/argonaut_observation_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_observation_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb b/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb index 20d4b7ae0..56065f0cf 100644 --- a/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb b/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb index b2deade1d..875936521 100644 --- a/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_procedure_sequence_test.rb b/test/sequence/argonaut/argonaut_procedure_sequence_test.rb index c3e322a49..81a8d180d 100644 --- a/test/sequence/argonaut/argonaut_procedure_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_procedure_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb b/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb index 162f87c48..b4cac1530 100644 --- a/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb b/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb index 93951c3e0..921401872 100644 --- a/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/medication_order_sequence_test.rb b/test/sequence/medication_order_sequence_test.rb index fa664c67b..749980440 100644 --- a/test/sequence/medication_order_sequence_test.rb +++ b/test/sequence/medication_order_sequence_test.rb @@ -59,15 +59,7 @@ def setup resource_id: @patient_id ) - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: 'MedicationOrder', - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, 'MedicationOrder') client = FHIR::Client.new(@instance.url) client.use_dstu2 diff --git a/test/sequence/medication_statement_sequence_test.rb b/test/sequence/medication_statement_sequence_test.rb index a313323cb..172933dc7 100644 --- a/test/sequence/medication_statement_sequence_test.rb +++ b/test/sequence/medication_statement_sequence_test.rb @@ -33,16 +33,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: 'MedicationStatement', - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, 'MedicationStatement') @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/onc_program/onc_program_document_reference_test.rb b/test/sequence/onc_program/onc_program_document_reference_test.rb index 687bcb00c..4661da75c 100644 --- a/test/sequence/onc_program/onc_program_document_reference_test.rb +++ b/test/sequence/onc_program/onc_program_document_reference_test.rb @@ -30,16 +30,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/onc_program/onc_program_provenance_test.rb b/test/sequence/onc_program/onc_program_provenance_test.rb index b9cd799b6..f9dd47095 100644 --- a/test/sequence/onc_program/onc_program_provenance_test.rb +++ b/test/sequence/onc_program/onc_program_provenance_test.rb @@ -31,16 +31,7 @@ def setup resource_id: @patient_id ) - # Register that the server supports MedicationStatement - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: @resource_type.to_s, - testing_instance_id: @instance.id, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true - ) + set_resource_support(@instance, @resource_type) @instance.save! # this is for convenience. we could rewrite to ensure nothing gets saved within tests. diff --git a/test/sequence/r4_provenance_sequence_test.rb b/test/sequence/r4_provenance_sequence_test.rb index d9bd39b57..5ef6c9409 100644 --- a/test/sequence/r4_provenance_sequence_test.rb +++ b/test/sequence/r4_provenance_sequence_test.rb @@ -49,12 +49,7 @@ def setup resource_id: @patient_id ) - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: 'Provenance', - testing_instance_id: @instance.id, - supported: true, - read_supported: true - ) + set_resource_support(@instance, 'Provenance') client = FHIR::Client.new(@instance.url) client.use_r4 diff --git a/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb b/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb index 867280eb7..a4a450ad0 100644 --- a/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb +++ b/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb @@ -28,12 +28,7 @@ def setup resource_id: @patient_id ) - @instance.supported_resources << Inferno::Models::SupportedResource.create( - resource_type: 'DocumentReference', - testing_instance_id: @instance.id, - supported: true, - read_supported: true - ) + set_resource_support(@instance, 'DocumentReference') @request_headers = { 'Accept' => 'application/fhir+json', diff --git a/test/test_helper.rb b/test/test_helper.rb index 58c3c8528..464578ea9 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -82,4 +82,27 @@ def get_client(instance) client end +def set_resource_support(instance, resource) + interactions = ['read', 'search-type', 'history-instance', 'vread'].map do |interaction| + { + code: interaction + } + end + Inferno::Models::ServerCapabilities.create( + testing_instance_id: instance.id, + capabilities: { + rest: [ + { + resource: [ + { + type: resource.to_s, + interaction: interactions + } + ] + } + ] + } + ) +end + FHIR::DSTU2::StructureDefinition.clear_all_validates_vs From c6410d3a061390ee8e18ed40300e12eb808d709e Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Mon, 12 Aug 2019 10:46:36 -0400 Subject: [PATCH 52/65] update condition for resource not supported warning icon --- lib/app/views/test_case.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/views/test_case.erb b/lib/app/views/test_case.erb index 4060ebd02..33077caf2 100644 --- a/lib/app/views/test_case.erb +++ b/lib/app/views/test_case.erb @@ -93,7 +93,7 @@
<% if show_button %>
- <%if !sequence_results[test_case.id] && instance.supported_resources.length > 0 && !test_case.sequence.conformance_supports.all?{|resource| instance.conformance_supported?(resource)}%> + <% if !sequence_results[test_case.id] && instance.server_capabilities.present? && !test_case.sequence.conformance_supports.all?{ |resource| instance.conformance_supported?(resource) } %> <%end%> From c9a1ed764a409a532da3edd9db685c21a1a0f1e4 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Mon, 12 Aug 2019 10:47:13 -0400 Subject: [PATCH 53/65] update testingInstance tests --- test/unit/test_instance_test.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/test/unit/test_instance_test.rb b/test/unit/test_instance_test.rb index 6893e6255..582d22adf 100644 --- a/test/unit/test_instance_test.rb +++ b/test/unit/test_instance_test.rb @@ -4,12 +4,16 @@ class TestInstanceTest < MiniTest::Test def setup - @instance = Inferno::Models::TestingInstance.create + @instance = Inferno::Models::TestingInstance.create(selected_module: 'us_core_r4') end def test_conformance_supported conformance = FHIR::DSTU2.from_contents(load_fixture(:conformance_statement)) - @instance.save_supported_resources(conformance) + Inferno::Models::ServerCapabilities.create( + testing_instance_id: @instance.id, + capabilities: conformance.as_json + ) + assert @instance.conformance_supported?(:Patient, [:read]) assert @instance.conformance_supported?(:Patient, [:read, :search, :history]) assert @instance.conformance_supported?(:Patient) @@ -20,7 +24,10 @@ def test_conformance_supported def test_conformance_supported_no_patient conformance = FHIR::DSTU2.from_contents(load_fixture(:conformance_statement)) conformance.rest.first.resource.reject! { |r| r.type == 'Patient' } - @instance.save_supported_resources(conformance) + Inferno::Models::ServerCapabilities.create( + testing_instance_id: @instance.id, + capabilities: conformance.as_json + ) assert !@instance.conformance_supported?(:Patient, [:read]) assert !@instance.conformance_supported?(:Patient, [:read, :search, :history]) @@ -31,7 +38,10 @@ def test_conformance_supported_no_patient def test_conformance_supported_no_patient_read conformance = FHIR::DSTU2.from_contents(load_fixture(:conformance_statement)) conformance.rest.first.resource.find { |r| r.type == 'Patient' }.interaction.reject! { |i| i.code == 'read' } - @instance.save_supported_resources(conformance) + Inferno::Models::ServerCapabilities.create( + testing_instance_id: @instance.id, + capabilities: conformance.as_json + ) assert @instance.conformance_supported?(:Patient) assert @instance.conformance_supported?(:Patient, [:search]) From 0c1aa946cb82163e215b48a380d84f1579f5e746 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Mon, 12 Aug 2019 10:52:02 -0400 Subject: [PATCH 54/65] remove remaining SupportedResource code --- lib/app/models.rb | 1 - lib/app/models/supported_resource.rb | 36 ---------- lib/app/models/testing_instance.rb | 61 +--------------- .../argonaut/argonaut_conformance_sequence.rb | 1 - ...s_core_r4_capability_statement_sequence.rb | 1 - test/model/supported_resource_test.rb | 69 ------------------- test/sequence/argonaut_query_test.rb | 5 +- 7 files changed, 5 insertions(+), 169 deletions(-) delete mode 100644 lib/app/models/supported_resource.rb delete mode 100644 test/model/supported_resource_test.rb diff --git a/lib/app/models.rb b/lib/app/models.rb index 5f98a9eeb..bb2ba0b96 100644 --- a/lib/app/models.rb +++ b/lib/app/models.rb @@ -7,7 +7,6 @@ require_relative 'models/request_response' require_relative 'models/resource_reference' require_relative 'models/sequence_result' -require_relative 'models/supported_resource' require_relative 'models/test_result' require_relative 'models/test_warning' require_relative 'models/testing_instance' diff --git a/lib/app/models/supported_resource.rb b/lib/app/models/supported_resource.rb deleted file mode 100644 index 64e049e44..000000000 --- a/lib/app/models/supported_resource.rb +++ /dev/null @@ -1,36 +0,0 @@ -# frozen_string_literal: true - -module Inferno - module Models - class SupportedResource - include DataMapper::Resource - property :id, String, key: true, default: proc { SecureRandom.uuid } - property :index, Integer - property :resource_type, String - property :supported, Boolean, default: false - property :read_supported, Boolean, default: false - property :vread_supported, Boolean, default: false - property :history_supported, Boolean, default: false - property :search_supported, Boolean, default: false - property :scope_supported, Boolean, default: false - - belongs_to :testing_instance - - # Returns an array containing the supported interaction of the resource - # - # @return [Array, nil] the supported interactions - # Returns nil if resource is not supported - def supported_interactions - return nil unless supported - - interactions = [] - interactions << :read if read_supported - interactions << :vread if vread_supported - interactions << :search if search_supported - interactions << :history if history_supported - interactions << :authorized if scope_supported - interactions - end - end - end -end diff --git a/lib/app/models/testing_instance.rb b/lib/app/models/testing_instance.rb index 0a00fbdc0..d173fd5ff 100644 --- a/lib/app/models/testing_instance.rb +++ b/lib/app/models/testing_instance.rb @@ -56,7 +56,6 @@ class TestingInstance property :must_support_confirmed, String, default: '' has n, :sequence_results - has n, :supported_resources, order: [:index.asc] has n, :resource_references has 1, :server_capabilities @@ -165,60 +164,6 @@ def testable_resources self.module.resources_to_test & (server_capabilities&.supported_resources || Set.new) end - def save_supported_resources(conformance) - resources = ['Patient', - 'AllergyIntolerance', - 'CarePlan', - 'CareTeam', - 'Condition', - 'Device', - 'DiagnosticReport', - 'DocumentReference', - 'Encounter', - 'ExplanationOfBenefit', - 'Goal', - 'Immunization', - 'Location', - 'Medication', - 'MedicationDispense', - 'MedicationStatement', - 'MedicationRequest', - 'MedicationOrder', - 'Observation', - 'Organization', - 'Procedure', - 'DocumentReference', - 'Provenance', - 'Practitioner', - 'PractitionerRole'] - - supported_resource_capabilities = - conformance - .rest.first.resource - .select { |resource| resources.include? resource.type } - .index_by(&:type) - - supported_resources.each(&:destroy) - save! - - resources.each_with_index do |resource_name, index| - capabilities = supported_resource_capabilities[resource_name] - - supported_resources << SupportedResource.create( - resource_type: resource_name, - index: index, - testing_instance_id: id, - supported: !capabilities.nil?, - read_supported: interaction_supported?(capabilities, 'read'), - vread_supported: interaction_supported?(capabilities, 'vread'), - search_supported: interaction_supported?(capabilities, 'search-type'), - history_supported: interaction_supported?(capabilities, 'history-instance') - ) - end - - save! - end - def supported_resource_interactions return [] if server_capabilities.blank? @@ -236,11 +181,7 @@ def conformance_supported?(resource, methods = []) return false if resource_support.blank? methods.all? do |method| - if method == :history - method = 'history-instance' - else - method = method.to_s - end + method = method == :history ? 'history-instance' : method.to_s resource_support[:interactions].include? method end diff --git a/lib/app/modules/argonaut/argonaut_conformance_sequence.rb b/lib/app/modules/argonaut/argonaut_conformance_sequence.rb index c5455d9ee..daed723a8 100644 --- a/lib/app/modules/argonaut/argonaut_conformance_sequence.rb +++ b/lib/app/modules/argonaut/argonaut_conformance_sequence.rb @@ -143,7 +143,6 @@ class ArgonautConformanceSequence < CapabilityStatementSequence assert @conformance.class == versioned_conformance_class, 'Expected valid Conformance resource' begin - @instance.save_supported_resources(@conformance) Inferno::Models::ServerCapabilities.create( testing_instance_id: @instance.id, capabilities: @conformance.as_json diff --git a/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb b/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb index 90fb39bfb..537aa16ec 100644 --- a/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb +++ b/lib/app/modules/us_core_r4/us_core_r4_capability_statement_sequence.rb @@ -143,7 +143,6 @@ class UsCoreR4CapabilityStatementSequence < CapabilityStatementSequence assert @conformance.class == versioned_conformance_class, 'Expected valid Capability resource' begin - @instance.save_supported_resources(@conformance) Inferno::Models::ServerCapabilities.create( testing_instance_id: @instance.id, capabilities: @conformance.as_json diff --git a/test/model/supported_resource_test.rb b/test/model/supported_resource_test.rb deleted file mode 100644 index f6c6f24b3..000000000 --- a/test/model/supported_resource_test.rb +++ /dev/null @@ -1,69 +0,0 @@ -# frozen_string_literal: true - -require_relative '../test_helper' - -class SupportedResourceTest < MiniTest::Test - def setup - resource1 = { - attributes: { - resource_type: 'Patient', - index: 1, - testing_instance_id: 1, - supported: true, - read_supported: true, - vread_supported: true, - search_supported: true, - history_supported: true, - scope_supported: true - }, - description: 'supported and supports all operations', - expected_respones: { - validate_supported_interactions: - %i[read vread search history authorized] - } - } - - resource2 = resource1.deep_dup - resource2[:attributes][:supported] = false - resource2[:description] = 'not supported, but supports all operations' - resource2[:expected_respones][:validate_supported_interactions] = nil - - resource3 = resource1.deep_dup - resource3[:attributes][:vread_supported] = false - resource3[:description] = 'supported and supports all operations except vread' - resource3[:expected_respones][:validate_supported_interactions] = %i[read search history authorized] - - @supported_test_cases = [resource1, resource3] - @supported_test_cases.each do |test_case| - test_case[:instance] = Inferno::Models::SupportedResource.create(test_case[:attributes]) - end - - @unsupported_test_cases = [resource2] - @unsupported_test_cases.each do |test_case| - test_case[:instance] = Inferno::Models::SupportedResource.create(test_case[:attributes]) - end - end - - def validate_supported_interactions(resource_to_test, expected_response) - assert_equal expected_response, resource_to_test.supported_interactions - end - - def validate_unsupported_interactions(resource_to_test, expected_response) - assert_nil expected_response - assert_nil resource_to_test.supported_interactions - end - - def test_supported_interactions_all_pass - @supported_test_cases.each do |test_case| - validate_supported_interactions(test_case[:instance], - test_case[:expected_respones][:validate_supported_interactions]) - end - end - - def test_unsupported_interactions_all_pass - @unsupported_test_cases.each do |test_case| - validate_unsupported_interactions(test_case[:instance], - test_case[:expected_respones][:validate_supported_interactions]) - end - end -end diff --git a/test/sequence/argonaut_query_test.rb b/test/sequence/argonaut_query_test.rb index bfa9a333d..39c4e6f1d 100644 --- a/test/sequence/argonaut_query_test.rb +++ b/test/sequence/argonaut_query_test.rb @@ -26,7 +26,10 @@ def setup oauth_authorize_endpoint: 'http://oauth_reg.example.com/authorize', oauth_token_endpoint: 'http://oauth_reg.example.com/token', scopes: 'launch openid patient/*.* profile') - @instance.save_supported_resources(@conformance) + Inferno::Models::ServerCapabilities.create( + testing_instance_id: @instance.id, + capabilities: @conformance.as_json + ) @instance.resource_references << Inferno::Models::ResourceReference.new( resource_type: 'Patient', resource_id: @patient_id From af3207aefd2ddf2d33f184732fa8b95a0d623fdc Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Mon, 12 Aug 2019 12:10:10 -0400 Subject: [PATCH 55/65] add supported_interactions test --- test/model/server_capabilities_test.rb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/model/server_capabilities_test.rb b/test/model/server_capabilities_test.rb index ec9717096..1e4e44a7f 100644 --- a/test/model/server_capabilities_test.rb +++ b/test/model/server_capabilities_test.rb @@ -16,7 +16,7 @@ def setup { code: 'read' }, { code: 'vread' }, { code: 'history-instance' }, - { code: 'search' } + { code: 'search-type' } ] }, { @@ -45,4 +45,23 @@ def test_supported_resources assert @capabilities.supported_resources == expected_resources end + + def test_supported_interactions + expected_interactions = [ + { + resource_type: 'Patient', + interactions: ['history-instance', 'read', 'search', 'vread'] + }, + { + resource_type: 'Condition', + interactions: ['delete', 'update'] + }, + { + resource_type: 'Observation', + interactions: [] + } + ] + + assert @capabilities.supported_interactions == expected_interactions + end end From cbf9e41f3d246fdf0e5fd4cdad0b6a5fc9095b29 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Tue, 20 Aug 2019 14:58:17 -0400 Subject: [PATCH 56/65] remove unused method --- lib/app/models/testing_instance.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/app/models/testing_instance.rb b/lib/app/models/testing_instance.rb index d173fd5ff..2e76ed68f 100644 --- a/lib/app/models/testing_instance.rb +++ b/lib/app/models/testing_instance.rb @@ -226,10 +226,6 @@ def versioned_conformance_class private - def interaction_supported?(capabilities, interaction_code) - capabilities&.interaction&.any? { |i| i.code == interaction_code } - end - def group_result(results) return :skip if results[:skip].positive? return :fail if results[:fail].positive? From 55daff32c9d306c8df11f7715a6833e75742d0bb Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Wed, 21 Aug 2019 11:00:38 -0400 Subject: [PATCH 57/65] reword error for unknown iss --- lib/app/endpoint/oauth2_endpoints.rb | 2 +- lib/app/utils/oauth2_error_messages.rb | 4 ++-- test/integration/oauth2_endpoints_test.rb | 15 ++++++++++----- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/app/endpoint/oauth2_endpoints.rb b/lib/app/endpoint/oauth2_endpoints.rb index d251cae1d..7ef193423 100644 --- a/lib/app/endpoint/oauth2_endpoints.rb +++ b/lib/app/endpoint/oauth2_endpoints.rb @@ -40,7 +40,7 @@ def instance_id_from_cookie halt 500, no_instance_for_iss_error_message if @instance.nil? if @instance.waiting_on_sequence&.wait? - @error_message = no_iss_error_message + @error_message = unknown_iss_error_message resume_execution else redirect "#{base_path}/#{cookies[:instance_id_test_set]}/?error=no_ehr_launch&iss=#{params[:iss]}" diff --git a/lib/app/utils/oauth2_error_messages.rb b/lib/app/utils/oauth2_error_messages.rb index be538055e..594285484 100644 --- a/lib/app/utils/oauth2_error_messages.rb +++ b/lib/app/utils/oauth2_error_messages.rb @@ -41,8 +41,8 @@ def no_instance_for_iss_error_message ) end - def no_iss_error_message - 'No iss for redirect' + def unknown_iss_error_message + params[:iss].present? ? "Unknown iss: #{params[:iss]}" : 'No iss for redirect' end def no_running_test_error_message diff --git a/test/integration/oauth2_endpoints_test.rb b/test/integration/oauth2_endpoints_test.rb index 1c1e022d3..194d4eda2 100644 --- a/test/integration/oauth2_endpoints_test.rb +++ b/test/integration/oauth2_endpoints_test.rb @@ -78,7 +78,8 @@ def test_launch_response_not_running end end - def test_launch_response_no_iss + def test_launch_response_unknown_iss + bad_iss = 'http://example.com/UNKNOWN_ISS' instance = create_testing_instance(url: 'http://example.com/no_iss') sequence_result = create_sequence_result( testing_instance: instance, @@ -91,16 +92,18 @@ def test_launch_response_no_iss EventMachine.run do cookies = { 'HTTP_COOKIE' => "instance_id_test_set=#{instance.id}/" } - get '/inferno/oauth2/static/launch', {}, cookies + get "/inferno/oauth2/static/launch?iss=#{bad_iss}", {}, cookies assert last_response.ok? redirect_path = "#{Inferno::BASE_PATH}/#{instance.id}/test_sets/#{sequence_result.test_set_id}/#SMARTonFHIRTesting/#{sequence_result.test_case_id}" assert last_response.body.include? js_redirect(redirect_path) - assert sequence_result.test_results.any? do |result| - result.fail? && result.message == 'No iss for redirect' + failure_found = sequence_result.test_results.any? do |result| + result.fail? && result.message == "Unknown iss: #{bad_iss}" end + + assert failure_found break end end @@ -182,9 +185,11 @@ def test_redirect_response_bad_state redirect_path = "#{Inferno::BASE_PATH}/#{instance.id}/test_sets/#{sequence_result.test_set_id}/#SMARTonFHIRTesting/#{sequence_result.test_case_id}" assert last_response.body.include? js_redirect(redirect_path) - assert sequence_result.test_results.any? do |result| + failure_found = sequence_result.test_results.any? do |result| result.fail? && result.message.start_with?('State provided in redirect') end + + assert failure_found break end end From dd4f90c738f0c568982a6072aab99baf71b96934 Mon Sep 17 00:00:00 2001 From: Stephen MacVicar Date: Thu, 22 Aug 2019 07:46:21 -0400 Subject: [PATCH 58/65] add no iss test --- lib/app/utils/oauth2_error_messages.rb | 6 ++++- test/integration/oauth2_endpoints_test.rb | 29 +++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/app/utils/oauth2_error_messages.rb b/lib/app/utils/oauth2_error_messages.rb index 594285484..db8550859 100644 --- a/lib/app/utils/oauth2_error_messages.rb +++ b/lib/app/utils/oauth2_error_messages.rb @@ -42,7 +42,11 @@ def no_instance_for_iss_error_message end def unknown_iss_error_message - params[:iss].present? ? "Unknown iss: #{params[:iss]}" : 'No iss for redirect' + params[:iss].present? ? "Unknown iss: #{params[:iss]}" : no_iss_error_message + end + + def no_iss_error_message + 'No iss querystring parameter provided to launch uri' end def no_running_test_error_message diff --git a/test/integration/oauth2_endpoints_test.rb b/test/integration/oauth2_endpoints_test.rb index 194d4eda2..d8822f38b 100644 --- a/test/integration/oauth2_endpoints_test.rb +++ b/test/integration/oauth2_endpoints_test.rb @@ -78,6 +78,35 @@ def test_launch_response_not_running end end + def test_launch_response_no_iss + instance = create_testing_instance(url: 'http://example.com/no_iss') + sequence_result = create_sequence_result( + testing_instance: instance, + wait_at_endpoint: 'launch', + redirect_to_url: '/redirect' + ) + Inferno::Models::TestResult.create( + sequence_result: sequence_result + ) + + EventMachine.run do + cookies = { 'HTTP_COOKIE' => "instance_id_test_set=#{instance.id}/" } + get '/inferno/oauth2/static/launch', {}, cookies + + assert last_response.ok? + + redirect_path = "#{Inferno::BASE_PATH}/#{instance.id}/test_sets/#{sequence_result.test_set_id}/#SMARTonFHIRTesting/#{sequence_result.test_case_id}" + assert last_response.body.include? js_redirect(redirect_path) + + failure_found = sequence_result.test_results.any? do |result| + result.fail? && result.message == 'No iss querystring parameter provided to launch uri' + end + + assert failure_found + break + end + end + def test_launch_response_unknown_iss bad_iss = 'http://example.com/UNKNOWN_ISS' instance = create_testing_instance(url: 'http://example.com/no_iss') From 46faa4a8efa7ce1e9ce8e0daa3a8da82d3a15b01 Mon Sep 17 00:00:00 2001 From: Hershil Patel Date: Thu, 22 Aug 2019 18:03:18 -0400 Subject: [PATCH 59/65] removed dead code --- lib/app/views/test_list.erb | 6 ------ 1 file changed, 6 deletions(-) diff --git a/lib/app/views/test_list.erb b/lib/app/views/test_list.erb index c0b5aea4f..6572743dd 100644 --- a/lib/app/views/test_list.erb +++ b/lib/app/views/test_list.erb @@ -45,24 +45,18 @@
- <% else %> -
<% end %> <% unless result.request_responses.find{ |f| f.direction == 'outbound'}.nil? %>
- <% else %> -
<% end %> <% unless result.request_responses.find{ |f| f.direction == 'inbound'}.nil? %>
- <% else %> -
<% end %> <% if result.result == 'todo' %> TODO: <% end %> From 851e576d4004eab1a6e5fd582a78b220a305920b Mon Sep 17 00:00:00 2001 From: Reece Adamson Date: Mon, 26 Aug 2019 13:06:44 -0400 Subject: [PATCH 60/65] update dependencies --- Gemfile.lock | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1330df39c..351a3b662 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -81,39 +81,40 @@ GEM do_sqlite3 (0.10.17) data_objects (= 0.10.17) docile (1.3.1) - domain_name (0.5.20180417) + domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) eventmachine (1.2.7) faraday (0.15.4) multipart-post (>= 1.2, < 3) fastercsv (1.5.5) - fhir_client (4.0.0) + fhir_client (4.0.2) activesupport (>= 3) addressable (>= 2.3) - fhir_dstu2_models (>= 1.0.9) - fhir_models (>= 4.0.0) - fhir_stu3_models (>= 3.0.0) - nokogiri (>= 1.8.2) + fhir_dstu2_models (>= 1.0.10) + fhir_models (>= 4.0.1) + fhir_stu3_models (>= 3.0.1) + nokogiri (>= 1.10.4) oauth2 (~> 1.1) rack (>= 1.5) rest-client (~> 2.0) tilt (>= 1.1) - fhir_dstu2_models (1.0.9) + fhir_dstu2_models (1.0.10) bcp47 (>= 0.3) date_time_precision (>= 0.8) mime-types (>= 3.0) - nokogiri (>= 1.8.5) - fhir_models (4.0.0) + nokogiri (>= 1.10.4) + fhir_models (4.0.1) bcp47 (>= 0.3) date_time_precision (>= 0.8) mime-types (>= 3.0) - nokogiri (>= 1.8.2) - fhir_stu3_models (3.0.0) + nokogiri (>= 1.10.4) + fhir_stu3_models (3.0.1) bcp47 (>= 0.3) date_time_precision (>= 0.8) mime-types (>= 3.0) - nokogiri (>= 1.8.2) + nokogiri (>= 1.10.4) hashdiff (0.3.9) + http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (1.6.0) @@ -125,7 +126,7 @@ GEM aes_key_wrap bindata json_pure (1.8.6) - jwt (2.1.0) + jwt (2.2.1) kramdown (2.1.0) method_source (0.9.2) mime-types (3.2.2) @@ -136,10 +137,10 @@ GEM msgpack (1.2.10) multi_json (1.13.1) multi_xml (0.6.0) - multipart-post (2.0.0) + multipart-post (2.1.1) mustermann (1.0.3) netrc (0.11.0) - nokogiri (1.10.3) + nokogiri (1.10.4) mini_portile2 (~> 2.4.0) oauth2 (1.4.1) faraday (>= 0.8, < 0.16.0) @@ -157,7 +158,7 @@ GEM byebug (~> 11.0) pry (~> 0.10) psych (3.1.0) - public_suffix (3.0.3) + public_suffix (3.1.1) rack (2.0.7) rack-protection (2.0.5) rack @@ -166,7 +167,8 @@ GEM rainbow (3.0.0) rake (12.3.2) rb-readline (0.5.5) - rest-client (2.0.2) + rest-client (2.1.0) + http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) From 29ae1bd29daecd08d2cf1192cbdce2a37de5144e Mon Sep 17 00:00:00 2001 From: Reece Adamson Date: Mon, 26 Aug 2019 13:11:17 -0400 Subject: [PATCH 61/65] update the other dependencies --- Gemfile.lock | 56 +++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 351a3b662..8f3ffeb05 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,11 +10,11 @@ GEM public_suffix (>= 2.0.2, < 4.0) aes_key_wrap (1.0.1) ast (2.4.0) - backports (3.13.0) + backports (3.15.0) base62-rb (0.3.1) bcp47 (0.3.3) i18n - bcrypt (3.1.12) + bcrypt (3.1.13) bcrypt-ruby (3.1.5) bcrypt (>= 3.1.3) bindata (2.4.4) @@ -80,7 +80,7 @@ GEM dm-core (~> 1.2.0) do_sqlite3 (0.10.17) data_objects (= 0.10.17) - docile (1.3.1) + docile (1.3.2) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) eventmachine (1.2.7) @@ -113,15 +113,15 @@ GEM date_time_precision (>= 0.8) mime-types (>= 3.0) nokogiri (>= 1.10.4) - hashdiff (0.3.9) + hashdiff (1.0.0) http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (1.6.0) concurrent-ruby (~> 1.0) - jaro_winkler (1.5.2) + jaro_winkler (1.5.3) json (1.8.6) - json-jwt (1.10.0) + json-jwt (1.10.2) activesupport (>= 4.2) aes_key_wrap bindata @@ -134,7 +134,7 @@ GEM mime-types-data (3.2019.0331) mini_portile2 (2.4.0) minitest (5.11.3) - msgpack (1.2.10) + msgpack (1.3.1) multi_json (1.13.1) multi_xml (0.6.0) multipart-post (2.1.1) @@ -149,7 +149,7 @@ GEM multi_xml (~> 0.5) rack (>= 1.2, < 3) parallel (1.17.0) - parser (2.6.2.1) + parser (2.6.3.0) ast (~> 2.4.0) pry (0.12.2) coderay (~> 1.1.0) @@ -157,53 +157,51 @@ GEM pry-byebug (3.7.0) byebug (~> 11.0) pry (~> 0.10) - psych (3.1.0) public_suffix (3.1.1) rack (2.0.7) - rack-protection (2.0.5) + rack-protection (2.0.7) rack rack-test (1.1.0) rack (>= 1.0, < 3) rainbow (3.0.0) - rake (12.3.2) + rake (12.3.3) rb-readline (0.5.5) rest-client (2.1.0) http-accept (>= 1.7.0, < 2.0) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rubocop (0.67.2) + rubocop (0.74.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5, != 2.5.1.1) - psych (>= 3.1.0) + parser (>= 2.6) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.6) - ruby-progressbar (1.10.0) - rubyzip (1.2.2) + unicode-display_width (>= 1.4.0, < 1.7) + ruby-progressbar (1.10.1) + rubyzip (1.2.3) safe_yaml (1.0.5) - selenium-webdriver (3.141.5926) + selenium-webdriver (3.142.3) childprocess (>= 0.5, < 2.0) rubyzip (~> 1.2, >= 1.2.2) - simplecov (0.16.1) + simplecov (0.17.0) docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) - sinatra (2.0.5) + sinatra (2.0.7) mustermann (~> 1.0) rack (~> 2.0) - rack-protection (= 2.0.5) + rack-protection (= 2.0.7) tilt (~> 2.0) - sinatra-contrib (2.0.5) + sinatra-contrib (2.0.7) backports (>= 2.8.2) multi_json mustermann (~> 1.0) - rack-protection (= 2.0.5) - sinatra (= 2.0.5) - tilt (>= 1.3, < 3) - sqlite3 (1.4.0) + rack-protection (= 2.0.7) + sinatra (= 2.0.7) + tilt (~> 2.0) + sqlite3 (1.4.1) stringex (1.5.1) thin (1.7.2) daemons (~> 1.0, >= 1.0.9) @@ -218,12 +216,12 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.6) - unicode-display_width (1.5.0) + unicode-display_width (1.6.0) uuidtools (2.1.5) - webmock (3.5.1) + webmock (3.6.2) addressable (>= 2.3.6) crack (>= 0.3.2) - hashdiff + hashdiff (>= 0.4.0, < 2.0.0) PLATFORMS ruby From 57ad89f742eab14bc1ae98844c357f0e966e05b9 Mon Sep 17 00:00:00 2001 From: Reece Adamson Date: Mon, 26 Aug 2019 13:11:41 -0400 Subject: [PATCH 62/65] update tests for changes in rest-client --- ...onaut_allergy_intolerance_sequence_test.rb | 2 +- .../argonaut_careplan_sequence_test.rb | 2 +- .../argonaut_careteam_sequence_test.rb | 2 +- .../argonaut_condition_sequence_test.rb | 2 +- .../argonaut/argonaut_device_sequence_test.rb | 2 +- ...rgonaut_diagnostic_report_sequence_test.rb | 2 +- .../argonaut/argonaut_goal_sequence_test.rb | 2 +- .../argonaut_immunization_sequence_test.rb | 2 +- ...argonaut_medication_order_sequence_test.rb | 2 +- ...naut_medication_statement_sequence_test.rb | 2 +- .../argonaut_observation_sequence_test.rb | 2 +- ...rgonaut_patient_read_only_sequence_test.rb | 21 --------------- .../argonaut_patient_search_sequence_test.rb | 2 +- .../argonaut_procedure_sequence_test.rb | 2 +- .../argonaut_smoking_status_sequence_test.rb | 21 --------------- ...t_vital_signs_observation_sequence_test.rb | 21 --------------- test/sequence/conformance_test.rb | 2 +- .../onc_program_document_reference_test.rb | 2 +- .../onc_program_provenance_test.rb | 27 ------------------- test/sequence/patient_read_sequence_test.rb | 2 +- .../us_core_r4/clinicalnotes_sequence_test.rb | 2 +- 21 files changed, 17 insertions(+), 107 deletions(-) diff --git a/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb b/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb index 464571c8a..006178c0f 100644 --- a/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_allergy_intolerance_sequence_test.rb @@ -42,7 +42,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_careplan_sequence_test.rb b/test/sequence/argonaut/argonaut_careplan_sequence_test.rb index 5403a6c00..73863f2be 100644 --- a/test/sequence/argonaut/argonaut_careplan_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_careplan_sequence_test.rb @@ -42,7 +42,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_careteam_sequence_test.rb b/test/sequence/argonaut/argonaut_careteam_sequence_test.rb index f5c3252fa..c384ada80 100644 --- a/test/sequence/argonaut/argonaut_careteam_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_careteam_sequence_test.rb @@ -42,7 +42,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_condition_sequence_test.rb b/test/sequence/argonaut/argonaut_condition_sequence_test.rb index 5f6782156..c3620de1f 100644 --- a/test/sequence/argonaut/argonaut_condition_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_condition_sequence_test.rb @@ -43,7 +43,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_device_sequence_test.rb b/test/sequence/argonaut/argonaut_device_sequence_test.rb index 2683e0c4d..9692ea6bb 100644 --- a/test/sequence/argonaut/argonaut_device_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_device_sequence_test.rb @@ -43,7 +43,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb b/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb index 3b1b361f6..27987adce 100644 --- a/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_diagnostic_report_sequence_test.rb @@ -44,7 +44,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_goal_sequence_test.rb b/test/sequence/argonaut/argonaut_goal_sequence_test.rb index c7e212b1c..a1f7ce347 100644 --- a/test/sequence/argonaut/argonaut_goal_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_goal_sequence_test.rb @@ -43,7 +43,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_immunization_sequence_test.rb b/test/sequence/argonaut/argonaut_immunization_sequence_test.rb index 8f5cc3b43..342bd82fc 100644 --- a/test/sequence/argonaut/argonaut_immunization_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_immunization_sequence_test.rb @@ -43,7 +43,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb b/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb index 9c5a45963..5682408e3 100644 --- a/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_medication_order_sequence_test.rb @@ -44,7 +44,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb b/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb index d870eb472..8595ba83c 100644 --- a/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_medication_statement_sequence_test.rb @@ -44,7 +44,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_observation_sequence_test.rb b/test/sequence/argonaut/argonaut_observation_sequence_test.rb index 9d2804149..460f90076 100644 --- a/test/sequence/argonaut/argonaut_observation_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_observation_sequence_test.rb @@ -43,7 +43,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb b/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb index 56065f0cf..83be9a6e5 100644 --- a/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_patient_read_only_sequence_test.rb @@ -40,13 +40,6 @@ def setup 'User-Agent' => 'Ruby FHIR Client', 'Authorization' => "Bearer #{@instance.token}" } - @extended_request_headers = { 'Accept' => 'application/json+fhir', - 'Accept-Charset' => 'utf-8', - 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', - 'Host' => 'www.example.com', - 'Authorization' => "Bearer #{@instance.token}" } - @response_headers = { 'content-type' => 'application/json+fhir' } end @@ -70,20 +63,6 @@ def full_sequence_stubs body: @resource.to_json, headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # history should return a history bundle - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: wrap_resources_in_bundle(@resource, type: 'history').to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - - # vread should return an instance - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history/1") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: @resource.to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # Stub Patient for Reference Resolution Tests stub_request(:get, %r{example.com/Patient/}) .with(headers: { diff --git a/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb b/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb index 875936521..e661bd2f0 100644 --- a/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_patient_search_sequence_test.rb @@ -44,7 +44,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_procedure_sequence_test.rb b/test/sequence/argonaut/argonaut_procedure_sequence_test.rb index 81a8d180d..b4d6df6fb 100644 --- a/test/sequence/argonaut/argonaut_procedure_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_procedure_sequence_test.rb @@ -43,7 +43,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb b/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb index b4cac1530..d9bb361ec 100644 --- a/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_smoking_status_sequence_test.rb @@ -40,13 +40,6 @@ def setup 'User-Agent' => 'Ruby FHIR Client', 'Authorization' => "Bearer #{@instance.token}" } - @extended_request_headers = { 'Accept' => 'application/json+fhir', - 'Accept-Charset' => 'utf-8', - 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', - 'Host' => 'www.example.com', - 'Authorization' => "Bearer #{@instance.token}" } - @response_headers = { 'content-type' => 'application/json+fhir' } end @@ -69,20 +62,6 @@ def full_sequence_stubs body: @resource.to_json, headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # history should return a history bundle - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: wrap_resources_in_bundle(@resource, type: 'history').to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - - # vread should return an instance - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history/1") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: @resource.to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # Stub Patient for Reference Resolution Tests stub_request(:get, %r{example.com/Patient/}) .with(headers: { diff --git a/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb b/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb index 921401872..152dd07fa 100644 --- a/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb +++ b/test/sequence/argonaut/argonaut_vital_signs_observation_sequence_test.rb @@ -40,13 +40,6 @@ def setup 'User-Agent' => 'Ruby FHIR Client', 'Authorization' => "Bearer #{@instance.token}" } - @extended_request_headers = { 'Accept' => 'application/json+fhir', - 'Accept-Charset' => 'utf-8', - 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', - 'Host' => 'www.example.com', - 'Authorization' => "Bearer #{@instance.token}" } - @response_headers = { 'content-type' => 'application/json+fhir' } end @@ -69,20 +62,6 @@ def full_sequence_stubs body: @resource.to_json, headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # history should return a history bundle - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: wrap_resources_in_bundle(@resource, type: 'history').to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - - # vread should return an instance - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history/1") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: @resource.to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # Stub Patient for Reference Resolution Tests stub_request(:get, %r{example.com/Patient/}) .with(headers: { diff --git a/test/sequence/conformance_test.rb b/test/sequence/conformance_test.rb index f9f5496db..34f5fdee3 100644 --- a/test/sequence/conformance_test.rb +++ b/test/sequence/conformance_test.rb @@ -7,7 +7,7 @@ class ConformanceSequenceTest < MiniTest::Test REQUEST_HEADERS = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'User-Agent' => 'Ruby FHIR Client' }.freeze diff --git a/test/sequence/onc_program/onc_program_document_reference_test.rb b/test/sequence/onc_program/onc_program_document_reference_test.rb index 4661da75c..0a1a86efc 100644 --- a/test/sequence/onc_program/onc_program_document_reference_test.rb +++ b/test/sequence/onc_program/onc_program_document_reference_test.rb @@ -42,7 +42,7 @@ def setup @extended_request_headers = { 'Accept' => 'application/json+fhir', 'Accept-Charset' => 'utf-8', 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Host' => 'www.example.com', 'Authorization' => "Bearer #{@instance.token}" } diff --git a/test/sequence/onc_program/onc_program_provenance_test.rb b/test/sequence/onc_program/onc_program_provenance_test.rb index f9dd47095..8bf7b522a 100644 --- a/test/sequence/onc_program/onc_program_provenance_test.rb +++ b/test/sequence/onc_program/onc_program_provenance_test.rb @@ -40,13 +40,6 @@ def setup 'User-Agent' => 'Ruby FHIR Client', 'Authorization' => "Bearer #{@instance.token}" } - @extended_request_headers = { 'Accept' => 'application/json+fhir', - 'Accept-Charset' => 'utf-8', - 'User-Agent' => 'Ruby FHIR Client', - 'Accept-Encoding' => 'gzip, deflate', - 'Host' => 'www.example.com', - 'Authorization' => "Bearer #{@instance.token}" } - @response_headers = { 'content-type' => 'application/json+fhir' } end @@ -69,26 +62,6 @@ def full_sequence_stubs body: @resource.to_json, headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # history should return a history bundle - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: wrap_resources_in_bundle(@resource, type: 'history').to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - - # vread should return an instance - stub_request(:get, "http://www.example.com/#{@resource_type}/#{@resource.id}/_history/1") - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: @resource.to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - - stub_request(:get, uri_template) - .with(headers: @extended_request_headers) - .to_return(status: 200, - body: @resource_bundle.to_json, - headers: { content_type: 'application/json+fhir; charset=UTF-8' }) - # Stub Patient for Reference Resolution Tests stub_request(:get, %r{example.com/Patient/}) .with(headers: { diff --git a/test/sequence/patient_read_sequence_test.rb b/test/sequence/patient_read_sequence_test.rb index 8e0d0f0ff..934ae5d00 100644 --- a/test/sequence/patient_read_sequence_test.rb +++ b/test/sequence/patient_read_sequence_test.rb @@ -42,7 +42,7 @@ def setup 'User-Agent' => 'Ruby FHIR Client', 'Authorization' => "Bearer #{@instance.token}", 'Host' => 'www.example.com', - 'Accept-Encoding' => 'gzip, deflate' + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3' } @response_headers = { 'content-type' => 'application/json+fhir' } end diff --git a/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb b/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb index a4a450ad0..4b856596e 100644 --- a/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb +++ b/test/sequence/us_core_r4/clinicalnotes_sequence_test.rb @@ -33,7 +33,7 @@ def setup @request_headers = { 'Accept' => 'application/fhir+json', 'Accept-Charset' => 'utf-8', - 'Accept-Encoding' => 'gzip, deflate', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer 99897979', 'Host' => 'www.example.com', 'User-Agent' => 'Ruby FHIR Client' From 08a2c013a5048c5c083beac39f6b966085632f53 Mon Sep 17 00:00:00 2001 From: Reece Adamson Date: Mon, 26 Aug 2019 13:29:39 -0400 Subject: [PATCH 63/65] rubocop fixes --- lib/app/utils/search_validation.rb | 2 +- lib/app/utils/terminology.rb | 12 ++++++------ lib/tasks/tasks.rake | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/app/utils/search_validation.rb b/lib/app/utils/search_validation.rb index de6b95ac6..e8565fe8e 100644 --- a/lib/app/utils/search_validation.rb +++ b/lib/app/utils/search_validation.rb @@ -43,7 +43,7 @@ def fhir_date_comparer(search_range, target_range, comparator) !target_range[:start].nil? && !target_range[:end].nil? && search_range[:start] <= target_range[:start] && search_range[:end] >= target_range[:end] when 'ne' # the range of the search value does not fully contain the range of the target value target_range[:start].nil? || target_range[:end].nil? || search_range[:start] > target_range[:start] || search_range[:end] < target_range[:end] - when 'gt' # the range above the search value intersects (i.e. overlaps) with the range of the target value + when 'gt' # the range above the search value intersects (i.e. overlaps) with the range of the target value target_range[:end].nil? || search_range[:end] < target_range[:end] when 'lt' # the range below the search value intersects (i.e. overlaps) with the range of the target value target_range[:start].nil? || search_range[:start] > target_range[:start] diff --git a/lib/app/utils/terminology.rb b/lib/app/utils/terminology.rb index 8b6b1076f..d7e0bdd97 100644 --- a/lib/app/utils/terminology.rb +++ b/lib/app/utils/terminology.rb @@ -69,8 +69,8 @@ def self.load_terminology end code_system_hash[code] = description end - rescue StandardError => error - Inferno.logger.error error + rescue StandardError => e + Inferno.logger.error e end begin @@ -86,8 +86,8 @@ def self.load_terminology code_system_hash[code] = description if code_system_hash[code].nil? @@core_snomed[code] = description end - rescue StandardError => error - Inferno.logger.error error + rescue StandardError => e + Inferno.logger.error e end begin @@ -98,8 +98,8 @@ def self.load_terminology @@common_ucum << code end @@common_ucum.uniq! - rescue StandardError => error - Inferno.logger.error error + rescue StandardError => e + Inferno.logger.error e end @@loaded = true diff --git a/lib/tasks/tasks.rake b/lib/tasks/tasks.rake index 2e45cabb6..610e892a8 100644 --- a/lib/tasks/tasks.rake +++ b/lib/tasks/tasks.rake @@ -497,8 +497,8 @@ namespace :terminology do |_argv| _eventId: 'submit' }, max_redirects: 0) - rescue RestClient::ExceptionWithResponse => err - follow_redirect(err.response.headers[:location], err.response.headers[:set_cookie]) + rescue RestClient::ExceptionWithResponse => e + follow_redirect(e.response.headers[:location], e.response.headers[:set_cookie]) end puts 'Finished Downloading!' end From 9bfba807fd16c55b2fe8a5bb06bb9a7b6edc6a27 Mon Sep 17 00:00:00 2001 From: Reece Adamson Date: Tue, 27 Aug 2019 09:50:26 -0400 Subject: [PATCH 64/65] fix typo --- lib/app/modules/onc_program_module.yml | 2 +- lib/app/modules/onc_program_r4_module.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/app/modules/onc_program_module.yml b/lib/app/modules/onc_program_module.yml index 7d73521da..2331ed864 100644 --- a/lib/app/modules/onc_program_module.yml +++ b/lib/app/modules/onc_program_module.yml @@ -22,7 +22,7 @@ test_sets: Servers must provide the ability to register Inferno as a SMART on FHIR application. This set of tests provides the tester with registration information to be entered into the system under test. Once registered, the tester should be provided a *Client ID*, and optionally a *Client Secret*, to enter into Inferno. This set of tests also requires the server to demonstrate - the ability to provide required service metatdata through the discovery endpoints, including OAuth endpoints, + the ability to provide required service metadata through the discovery endpoints, including OAuth endpoints, supported resources and searches. input_instructions: | Register Inferno as a SMART on FHIR app with the following *Launch URI* and *Redirect URI*. You may either register the app as diff --git a/lib/app/modules/onc_program_r4_module.yml b/lib/app/modules/onc_program_r4_module.yml index 15c960756..bf7e9e7b0 100644 --- a/lib/app/modules/onc_program_r4_module.yml +++ b/lib/app/modules/onc_program_r4_module.yml @@ -21,7 +21,7 @@ test_sets: Servers must provide the ability to register Inferno as a SMART on FHIR application. This set of tests provides the tester with registration information to be entered into the system under test. Once registered, the tester should be provided a *Client ID*, and optionally a *Client Secret*, to enter into Inferno. This set of tests also requires the server to demonstrate - the ability to provide required service metatdata through the discovery endpoints, including OAuth endpoints, + the ability to provide required service metadata through the discovery endpoints, including OAuth endpoints, supported resources and searches. input_instructions: | Register Inferno as a SMART on FHIR app with the following *Launch URI* and *Redirect URI*. You may either register the app as From 4da27ee538d36bd197107de57b58b96ffac77915 Mon Sep 17 00:00:00 2001 From: Rob Scanlon Date: Wed, 28 Aug 2019 16:44:15 -0400 Subject: [PATCH 65/65] Update version to 2.5.0 --- lib/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/version.rb b/lib/version.rb index fa18f9d0e..800dcb9e9 100644 --- a/lib/version.rb +++ b/lib/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Inferno - VERSION = '2.4.0' + VERSION = '2.5.0' end