inferno_core 0.4.31 → 0.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cc7cf96fbaba860fa20b9d3ce24ece91e898f06006974536c46d15d0f875888
4
- data.tar.gz: 84eabfe9895b4dcd17d251b51e6cc7dceb9132ed7af66a3d0c707d6126e343ed
3
+ metadata.gz: ab7188504ca88cbb022aaab3dc6d42b4a818bec3cef33b3bf58a3cdea86babf2
4
+ data.tar.gz: 4ece00547e334cbde803409619443c41417a965e27fd820f760980e8211eada2
5
5
  SHA512:
6
- metadata.gz: 7772ee37760aed0f39a36972f0d6881166d7caef69d62b3df6f868f26d1f5948928dc8a05e392aaa35af11cb71f11cf7f18ed8d47fcefa1efa431f3685872319
7
- data.tar.gz: bf9319e60aff26082d19e67260ca93bb0e39304111f63a1ece0e4307b52c55a6da8a3959e227ea61c2848607f58a2087b340533d6e690125789f0b565919724c
6
+ metadata.gz: '0920f31658a7a783033db4a0ed1a2ffc476ef50ca18a3c12f590efa7a4967865c6553e07158d9a19792d498bd3e8e88e60c44a237686a849a07cca1b5364f8fe'
7
+ data.tar.gz: c18d9237d93908e09c3fbe0631419ff74511dcf7bd645970820ab19457ec454cd83cfcff3357e06e26afe43892c19a73ec1010d654999368f47438d73f5d5704
@@ -1,25 +1,23 @@
1
1
  # <%= title_name %> Test Kit
2
2
 
3
- <%= human_name %> [Inferno](https://github.com/inferno-community/inferno-core) test kit
3
+ <%= human_name %> [Inferno](https://github.com/inferno-community/inferno-core) Test Kit
4
4
  for FHIR testing.
5
5
 
6
- ## Documentation
7
- - [Inferno documentation](https://inferno-framework.github.io/inferno-core/)
8
- - [Ruby API documentation](https://inferno-framework.github.io/inferno-core/docs)
9
- - [JSON API documentation](https://inferno-framework.github.io/inferno-core/api-docs)
6
+ ## Instructions for Developing Your Test Kit
7
+
8
+ Refer to the Inferno documentation for information about [setting up
9
+ your development environment and running your Test Kit](https://inferno-framework.github.io/docs/getting-started/).
10
10
 
11
- ## Instructions for Developing tests
11
+ More information about what is included in this repository can be [found here](https://inferno-framework.github.io/docs/getting-started/repo-layout-and-organization.html).
12
12
 
13
- To get started writing tests, click "Use this template" on
14
- github or use the Ruby-based command: `gem install inferno_core && inferno new my-test-kit`.
15
- Refer to the Inferno documentation for information about [setting up your development
16
- environment and running
17
- Inferno](https://inferno-framework.github.io/inferno-core/getting-started.html#getting-started-for-inferno-test-writers).
13
+ ## Documentation
14
+ - [Inferno documentation](https://inferno-framework.github.io/docs/)
15
+ - [Ruby API documentation](https://inferno-framework.github.io/inferno-core/docs/)
16
+ - [JSON API documentation](https://inferno-framework.github.io/inferno-core/api-docs/)
18
17
 
19
- ## Example Inferno test kits
18
+ ## Example Inferno Test Kits
20
19
 
21
- - https://github.com/inferno-community/ips-test-kit
22
- - https://github.com/inferno-community/shc-vaccination-test-kit
20
+ A list of all Test Kits registered with the Inferno Team can be found on the [Test Kit Registry](https://inferno-framework.github.io/community/test-kits.html) page.
23
21
 
24
22
  ## License
25
23
  Copyright <%= Time.now.year %> TODO
@@ -0,0 +1,39 @@
1
+ module Inferno
2
+ module Web
3
+ module Controllers
4
+ class TestSessionFormPostController < Hanami::Action
5
+ def self.call(...)
6
+ new.call(...)
7
+ end
8
+
9
+ def handle(req, res)
10
+ test_suite_id = req.params[:test_suite_id]
11
+
12
+ test_suite = Inferno::Repositories::TestSuites.new.find(test_suite_id)
13
+ halt 404, "Unable to find test suite with id #{test_suite_id}" if test_suite.nil?
14
+
15
+ params = { test_suite_id: }
16
+ suite_option_keys = test_suite.suite_options.map(&:id)
17
+ options = req.params.to_h.slice(*suite_option_keys)
18
+
19
+ params[:suite_options] = options.map { |key, value| { id: key, value: } } if options.present?
20
+
21
+ repo = Inferno::Repositories::TestSessions.new
22
+ session = repo.create(params)
23
+
24
+ preset_id = req.params[:preset_id]
25
+
26
+ if preset_id.present?
27
+ preset = Inferno::Repositories::Presets.new.find(preset_id)
28
+
29
+ halt 422, "Unable to find preset with id #{preset_id} for test suite #{test_suite_id}" if preset.nil?
30
+
31
+ repo.apply_preset(session, preset_id)
32
+ end
33
+
34
+ res.redirect_to "#{Inferno::Application['base_url']}/#{test_suite_id}/#{session.id}"
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -72,6 +72,8 @@ module Inferno
72
72
 
73
73
  get '/test_sessions/:id', to: Inferno::Web::Controllers::TestSessions::ClientShow, as: :client_session_show
74
74
  get '/:test_suite_id/:id', to: Inferno::Web::Controllers::TestSessions::ClientShow, as: :client_suite_session_show
75
+
76
+ post '/:test_suite_id', to: Inferno::Web::Controllers::TestSessionFormPostController, as: :session_form_post
75
77
  end
76
78
 
77
79
  Router = # rubocop:disable Naming/ConstantName
@@ -177,6 +177,11 @@ module Inferno
177
177
  inputs[identifier]&.type
178
178
  end
179
179
 
180
+ # @private
181
+ def input_optional?(identifier)
182
+ inputs[identifier]&.optional
183
+ end
184
+
180
185
  ### Output Configuration ###
181
186
 
182
187
  # The output configuration for this runnable.
@@ -73,6 +73,8 @@ module Inferno
73
73
  result = begin
74
74
  raise Exceptions::CancelException, 'Test cancelled by user' if test_run_is_cancelling
75
75
 
76
+ check_inputs(test, test_instance, inputs)
77
+
76
78
  test_instance.load_named_requests
77
79
  test_instance.instance_eval(&test.block)
78
80
  'pass'
@@ -112,6 +114,16 @@ module Inferno
112
114
  test_result
113
115
  end
114
116
 
117
+ def check_inputs(test, _test_instance, inputs)
118
+ inputs.each do |key, value|
119
+ optional = test.config.input_optional?(key)
120
+ if value.nil? && !optional
121
+ raise Exceptions::SkipException,
122
+ "Input '#{test.config.input_name(key)}' is nil, skipping test."
123
+ end
124
+ end
125
+ end
126
+
115
127
  def run_group(group, scratch)
116
128
  group_inputs_with_values = group.available_inputs.map do |_input_identifier, input|
117
129
  {
@@ -1,4 +1,4 @@
1
1
  module Inferno
2
2
  # Standard patterns for gem versions: https://guides.rubygems.org/patterns/
3
- VERSION = '0.4.31'.freeze
3
+ VERSION = '0.4.32'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inferno_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.31
4
+ version: 0.4.32
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen MacVicar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2024-03-14 00:00:00.000000000 Z
13
+ date: 2024-03-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -580,6 +580,7 @@ files:
580
580
  - lib/inferno/apps/web/controllers/test_runs/destroy.rb
581
581
  - lib/inferno/apps/web/controllers/test_runs/results/index.rb
582
582
  - lib/inferno/apps/web/controllers/test_runs/show.rb
583
+ - lib/inferno/apps/web/controllers/test_session_form_post_controller.rb
583
584
  - lib/inferno/apps/web/controllers/test_sessions/client_show.rb
584
585
  - lib/inferno/apps/web/controllers/test_sessions/create.rb
585
586
  - lib/inferno/apps/web/controllers/test_sessions/last_test_run.rb