inferno_core 0.3.4 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/inferno/apps/web/controllers/test_runs/create.rb +8 -4
- data/lib/inferno/apps/web/controllers/test_sessions/create.rb +6 -3
- data/lib/inferno/apps/web/router.rb +5 -0
- data/lib/inferno/apps/web/serializers/input.rb +6 -2
- data/lib/inferno/apps/web/serializers/suite_option.rb +13 -0
- data/lib/inferno/apps/web/serializers/test.rb +4 -1
- data/lib/inferno/apps/web/serializers/test_group.rb +12 -3
- data/lib/inferno/apps/web/serializers/test_session.rb +5 -3
- data/lib/inferno/apps/web/serializers/test_suite.rb +10 -2
- data/lib/inferno/config/boot/presets.rb +1 -1
- data/lib/inferno/db/migrations/007_add_suite_options.rb +5 -0
- data/lib/inferno/db/schema.rb +1 -0
- data/lib/inferno/dsl/http_client.rb +14 -4
- data/lib/inferno/dsl/http_client_builder.rb +6 -1
- data/lib/inferno/dsl/input_output_handling.rb +55 -41
- data/lib/inferno/dsl/runnable.rb +12 -6
- data/lib/inferno/dsl/suite_option.rb +40 -0
- data/lib/inferno/entities/input.rb +2 -1
- data/lib/inferno/entities/test.rb +3 -1
- data/lib/inferno/entities/test_group.rb +4 -4
- data/lib/inferno/entities/test_session.rb +28 -0
- data/lib/inferno/entities/test_suite.rb +11 -4
- data/lib/inferno/public/72a5cd989e6aea904540824ec865a0f8.png +0 -0
- data/lib/inferno/public/bundle.js +15 -15
- data/lib/inferno/public/e09b16f5cb645eb05f90c8f38f3409fb.png +0 -0
- data/lib/inferno/repositories/presets.rb +10 -1
- data/lib/inferno/repositories/test_sessions.rb +24 -0
- data/lib/inferno/test_runner.rb +1 -1
- data/lib/inferno/version.rb +1 -1
- metadata +38 -7
- data/lib/inferno/public/bg-header-1920x170.png +0 -0
- data/lib/inferno/public/healthit.gov.logo.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20fc2d3e3d1a42d30682916011622f3827b809089883dc591f799bfbf334b1f8
|
4
|
+
data.tar.gz: f606bb9364a4e08b29754706692fc1e525e3592c2c01490183574673201ee1be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 271a59774aa21e093feace017269194676539e0685d87805fdca2c409d1de568cbd99147c16e9484ce416ac32fe1db2c22d323178db5729b52e11e616dbf07db
|
7
|
+
data.tar.gz: eca623df2965155c9b4867c426e75fba81758214495160afd8236ada7e6930fda72cab708561673c2daffd45045fb3fa8994e7d2b7194272eb543f9664cf6018
|
@@ -11,8 +11,8 @@ module Inferno
|
|
11
11
|
|
12
12
|
PARAMS = [:test_session_id, :test_suite_id, :test_group_id, :test_id].freeze
|
13
13
|
|
14
|
-
def verify_runnable(runnable, inputs)
|
15
|
-
missing_inputs = runnable&.missing_inputs(inputs)
|
14
|
+
def verify_runnable(runnable, inputs, selected_suite_options)
|
15
|
+
missing_inputs = runnable&.missing_inputs(inputs, selected_suite_options)
|
16
16
|
user_runnable = runnable&.user_runnable?
|
17
17
|
raise Inferno::Exceptions::RequiredInputsNotFound, missing_inputs if missing_inputs&.any?
|
18
18
|
raise Inferno::Exceptions::NotUserRunnableException unless user_runnable
|
@@ -26,7 +26,7 @@ module Inferno
|
|
26
26
|
&.last
|
27
27
|
|
28
28
|
if input.nil?
|
29
|
-
Inferno::Application['logger'].
|
29
|
+
Inferno::Application['logger'].warn(
|
30
30
|
"Unknown input `#{input_params[:name]}` for #{test_run.runnable.id}: #{test_run.runnable.title}"
|
31
31
|
)
|
32
32
|
next
|
@@ -51,7 +51,11 @@ module Inferno
|
|
51
51
|
return
|
52
52
|
end
|
53
53
|
|
54
|
-
verify_runnable(
|
54
|
+
verify_runnable(
|
55
|
+
repo.build_entity(create_params(params)).runnable,
|
56
|
+
params[:inputs],
|
57
|
+
test_session.suite_options
|
58
|
+
)
|
55
59
|
|
56
60
|
test_run = repo.create(create_params(params).merge(status: 'queued'))
|
57
61
|
|
@@ -3,9 +3,12 @@ module Inferno
|
|
3
3
|
module Controllers
|
4
4
|
module TestSessions
|
5
5
|
class Create < Controller
|
6
|
-
PARAMS = [:test_suite_id].freeze
|
6
|
+
PARAMS = [:test_suite_id, :suite_options].freeze
|
7
|
+
|
8
|
+
def call(raw_params)
|
9
|
+
params = raw_params.to_h
|
10
|
+
params.merge!(JSON.parse(request.body.string).symbolize_keys) unless request.body.string.blank?
|
7
11
|
|
8
|
-
def call(params)
|
9
12
|
session = repo.create(create_params(params))
|
10
13
|
|
11
14
|
repo.apply_preset(session.id, params[:preset_id]) if params[:preset_id].present?
|
@@ -21,7 +24,7 @@ module Inferno
|
|
21
24
|
end
|
22
25
|
|
23
26
|
def create_params(params)
|
24
|
-
params.
|
27
|
+
params.slice(*PARAMS)
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
@@ -51,6 +51,11 @@ module Inferno
|
|
51
51
|
send(route[:method], path, to: route[:handler])
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
Inferno::Repositories::TestSuites.all.map { |suite| "/#{suite.id}" }.each do |suite_path|
|
56
|
+
Application['logger'].info("Registering suite route: #{suite_path}")
|
57
|
+
get suite_path, to: ->(_env) { [200, {}, [client_page]] }
|
58
|
+
end
|
54
59
|
end
|
55
60
|
end
|
56
61
|
end
|
@@ -6,9 +6,13 @@ module Inferno
|
|
6
6
|
class Input < Serializer
|
7
7
|
identifier :name
|
8
8
|
|
9
|
-
field :
|
9
|
+
field :title, if: :field_present?
|
10
10
|
field :description, if: :field_present?
|
11
|
-
field :
|
11
|
+
field :type, if: :field_present?
|
12
|
+
field :default, if: :field_present?
|
13
|
+
field :optional, if: :field_present?
|
14
|
+
field :options, if: :field_present?
|
15
|
+
field :locked, if: :field_present?
|
12
16
|
field :value, if: :field_present?
|
13
17
|
end
|
14
18
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Inferno
|
2
|
+
module Web
|
3
|
+
module Serializers
|
4
|
+
class SuiteOption < Serializer
|
5
|
+
identifier :id
|
6
|
+
field :title, if: :field_present?
|
7
|
+
field :description, if: :field_present?
|
8
|
+
field :list_options, if: :field_present?
|
9
|
+
field :value, if: :field_present?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -7,7 +7,10 @@ module Inferno
|
|
7
7
|
field :short_id
|
8
8
|
field :title
|
9
9
|
field :short_title
|
10
|
-
field :
|
10
|
+
field :inputs do |test, options|
|
11
|
+
suite_options = options[:suite_options]
|
12
|
+
Input.render_as_hash(test.available_inputs(suite_options).values)
|
13
|
+
end
|
11
14
|
field :output_definitions, name: :outputs, extractor: HashValueExtractor
|
12
15
|
field :description
|
13
16
|
field :short_description
|
@@ -15,9 +15,18 @@ module Inferno
|
|
15
15
|
field :user_runnable?, name: :user_runnable
|
16
16
|
field :optional?, name: :optional
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
field :test_groups do |group, options|
|
19
|
+
suite_options = options[:suite_options]
|
20
|
+
TestGroup.render_as_hash(group.groups(suite_options), suite_options: suite_options)
|
21
|
+
end
|
22
|
+
field :tests do |group, options|
|
23
|
+
suite_options = options[:suite_options]
|
24
|
+
Test.render_as_hash(group.tests(suite_options), suite_options: suite_options)
|
25
|
+
end
|
26
|
+
field :inputs do |group, options|
|
27
|
+
suite_options = options[:suite_options]
|
28
|
+
Input.render_as_hash(group.available_inputs(suite_options).values)
|
29
|
+
end
|
21
30
|
field :output_definitions, name: :outputs, extractor: HashValueExtractor
|
22
31
|
end
|
23
32
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require_relative 'suite_option'
|
1
2
|
require_relative 'test_suite'
|
2
3
|
|
3
4
|
module Inferno
|
@@ -7,10 +8,11 @@ module Inferno
|
|
7
8
|
identifier :id
|
8
9
|
|
9
10
|
field :test_suite_id
|
11
|
+
association :suite_options, blueprint: SuiteOption
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
13
|
+
field :test_suite do |session, _options|
|
14
|
+
TestSuite.render_as_hash(session.test_suite, view: :full, suite_options: session.suite_options)
|
15
|
+
end
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -11,14 +11,22 @@ module Inferno
|
|
11
11
|
field :input_instructions
|
12
12
|
field :test_count
|
13
13
|
field :version
|
14
|
+
field :links
|
15
|
+
association :suite_options, blueprint: SuiteOption
|
14
16
|
association :presets, view: :summary, blueprint: Preset
|
15
17
|
end
|
16
18
|
|
17
19
|
view :full do
|
18
20
|
include_view :summary
|
19
|
-
|
21
|
+
field :test_groups do |suite, options|
|
22
|
+
suite_options = options[:suite_options]
|
23
|
+
TestGroup.render_as_hash(suite.groups(suite_options), suite_options: suite_options)
|
24
|
+
end
|
20
25
|
field :configuration_messages
|
21
|
-
field :
|
26
|
+
field :inputs do |suite, options|
|
27
|
+
suite_options = options[:suite_options]
|
28
|
+
Input.render_as_hash(suite.available_inputs(suite_options).values)
|
29
|
+
end
|
22
30
|
end
|
23
31
|
end
|
24
32
|
end
|
@@ -4,7 +4,7 @@ Inferno::Application.boot(:presets) do
|
|
4
4
|
init do
|
5
5
|
use :suites
|
6
6
|
|
7
|
-
files_to_load = Dir.glob(
|
7
|
+
files_to_load = Dir.glob(['config/presets/*.json', 'config/presets/*.json.erb'])
|
8
8
|
files_to_load.map! { |path| File.realpath(path) }
|
9
9
|
presets_repo = Inferno::Repositories::Presets.new
|
10
10
|
|
data/lib/inferno/db/schema.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'faraday_middleware'
|
2
|
+
|
1
3
|
require_relative 'request_storage'
|
2
4
|
require_relative 'tcp_exception_handler'
|
3
5
|
|
@@ -75,7 +77,7 @@ module Inferno
|
|
75
77
|
if client
|
76
78
|
client.get(url, nil, options[:headers])
|
77
79
|
elsif url.match?(%r{\Ahttps?://})
|
78
|
-
|
80
|
+
connection.get(url, nil, options[:headers])
|
79
81
|
else
|
80
82
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
81
83
|
end
|
@@ -83,6 +85,14 @@ module Inferno
|
|
83
85
|
end
|
84
86
|
end
|
85
87
|
|
88
|
+
# @private
|
89
|
+
def connection
|
90
|
+
Faraday.new do |f|
|
91
|
+
f.request :url_encoded
|
92
|
+
f.use FaradayMiddleware::FollowRedirects
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
86
96
|
# Perform an HTTP POST request
|
87
97
|
#
|
88
98
|
# @param url [String] if this request is using a defined client, this will
|
@@ -103,7 +113,7 @@ module Inferno
|
|
103
113
|
if client
|
104
114
|
client.post(url, body, options[:headers])
|
105
115
|
elsif url.match?(%r{\Ahttps?://})
|
106
|
-
|
116
|
+
connection.post(url, body, options[:headers])
|
107
117
|
else
|
108
118
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
109
119
|
end
|
@@ -128,7 +138,7 @@ module Inferno
|
|
128
138
|
if client
|
129
139
|
client.delete(url, nil, options[:headers])
|
130
140
|
elsif url.match?(%r{\Ahttps?://})
|
131
|
-
|
141
|
+
connection.delete(url, nil, options[:headers])
|
132
142
|
else
|
133
143
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
134
144
|
end
|
@@ -167,7 +177,7 @@ module Inferno
|
|
167
177
|
if client
|
168
178
|
response = client.get(url, nil, options[:headers]) { |req| req.options.on_data = collector }
|
169
179
|
elsif url.match?(%r{\Ahttps?://})
|
170
|
-
response =
|
180
|
+
response = connection.get(url, nil, options[:headers]) { |req| req.options.on_data = collector }
|
171
181
|
else
|
172
182
|
raise StandardError, 'Must use an absolute url or define an HTTP client with a base url'
|
173
183
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'faraday_middleware'
|
2
|
+
|
1
3
|
module Inferno
|
2
4
|
module DSL
|
3
5
|
# This module contains the HTTP DSL available to test writers.
|
@@ -12,7 +14,10 @@ module Inferno
|
|
12
14
|
params = { url: url }
|
13
15
|
params.merge!(headers: headers) if headers
|
14
16
|
|
15
|
-
Faraday.new(params)
|
17
|
+
Faraday.new(params) do |f|
|
18
|
+
f.request :url_encoded
|
19
|
+
f.use FaradayMiddleware::FollowRedirects
|
20
|
+
end
|
16
21
|
end
|
17
22
|
|
18
23
|
# Define the base url for an HTTP client. A string or symbol can be
|
@@ -24,10 +24,20 @@ module Inferno
|
|
24
24
|
[identifier, *other_identifiers].compact.each do |input_identifier|
|
25
25
|
inputs << input_identifier
|
26
26
|
config.add_input(input_identifier)
|
27
|
+
children
|
28
|
+
.reject { |child| child.inputs.include? input_identifier }
|
29
|
+
.each do |child|
|
30
|
+
child.input(input_identifier)
|
31
|
+
end
|
27
32
|
end
|
28
33
|
else
|
29
34
|
inputs << identifier
|
30
35
|
config.add_input(identifier, input_params)
|
36
|
+
children
|
37
|
+
.reject { |child| child.inputs.include? identifier }
|
38
|
+
.each do |child|
|
39
|
+
child.input(identifier, **input_params)
|
40
|
+
end
|
31
41
|
end
|
32
42
|
end
|
33
43
|
|
@@ -47,10 +57,20 @@ module Inferno
|
|
47
57
|
[identifier, *other_identifiers].compact.each do |output_identifier|
|
48
58
|
outputs << output_identifier
|
49
59
|
config.add_output(output_identifier)
|
60
|
+
children
|
61
|
+
.reject { |child| child.outputs.include? output_identifier }
|
62
|
+
.each do |child|
|
63
|
+
child.output(output_identifier)
|
64
|
+
end
|
50
65
|
end
|
51
66
|
else
|
52
67
|
outputs << identifier
|
53
68
|
config.add_output(identifier, output_definition)
|
69
|
+
children
|
70
|
+
.reject { |child| child.outputs.include? identifier }
|
71
|
+
.each do |child|
|
72
|
+
child.output(identifier, **output_definition)
|
73
|
+
end
|
54
74
|
end
|
55
75
|
end
|
56
76
|
|
@@ -70,17 +90,17 @@ module Inferno
|
|
70
90
|
end
|
71
91
|
|
72
92
|
# @private
|
73
|
-
def required_inputs
|
74
|
-
available_inputs
|
93
|
+
def required_inputs(selected_suite_options)
|
94
|
+
available_inputs(selected_suite_options)
|
75
95
|
.reject { |_, input| input.optional }
|
76
96
|
.map { |_, input| input.name }
|
77
97
|
end
|
78
98
|
|
79
99
|
# @private
|
80
|
-
def missing_inputs(submitted_inputs)
|
100
|
+
def missing_inputs(submitted_inputs, selected_suite_options)
|
81
101
|
submitted_inputs = [] if submitted_inputs.nil?
|
82
102
|
|
83
|
-
required_inputs.map(&:to_s) - submitted_inputs.map { |input| input[:name] }
|
103
|
+
required_inputs(selected_suite_options).map(&:to_s) - submitted_inputs.map { |input| input[:name] }
|
84
104
|
end
|
85
105
|
|
86
106
|
# Define a particular order for inputs to be presented in the API/UI
|
@@ -133,52 +153,46 @@ module Inferno
|
|
133
153
|
# Inputs available for this runnable's children. A running list of outputs
|
134
154
|
# created by the children is used to exclude any inputs which are provided
|
135
155
|
# by an earlier child's output.
|
136
|
-
def children_available_inputs
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
else
|
149
|
-
new_definition
|
150
|
-
end
|
151
|
-
|
152
|
-
next if child_outputs.include?(updated_definition.name.to_sym)
|
153
|
-
|
154
|
-
definitions[updated_definition.name.to_sym] = updated_definition
|
156
|
+
def children_available_inputs(selected_suite_options = nil)
|
157
|
+
child_outputs = []
|
158
|
+
children(selected_suite_options).each_with_object({}) do |child, definitions|
|
159
|
+
new_definitions = child.available_inputs(selected_suite_options).map(&:dup)
|
160
|
+
new_definitions.each do |input, new_definition|
|
161
|
+
existing_definition = definitions[input]
|
162
|
+
|
163
|
+
updated_definition =
|
164
|
+
if existing_definition.present?
|
165
|
+
existing_definition.merge_with_child(new_definition)
|
166
|
+
else
|
167
|
+
new_definition
|
155
168
|
end
|
156
169
|
|
157
|
-
|
158
|
-
|
170
|
+
next if child_outputs.include?(updated_definition.name.to_sym)
|
171
|
+
|
172
|
+
definitions[updated_definition.name.to_sym] = updated_definition
|
159
173
|
end
|
174
|
+
|
175
|
+
child_outputs.concat(child.all_outputs).uniq!
|
176
|
+
end
|
160
177
|
end
|
161
178
|
|
162
179
|
# @private
|
163
180
|
# Inputs available for the user for this runnable and all its children.
|
164
|
-
def available_inputs
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
.each_with_object({}) do |(_, input), inputs|
|
171
|
-
inputs[input.name.to_sym] = input
|
172
|
-
end
|
173
|
-
|
174
|
-
available_inputs.each do |input, current_definition|
|
175
|
-
child_definition = children_available_inputs[input]
|
176
|
-
current_definition.merge_with_child(child_definition)
|
181
|
+
def available_inputs(selected_suite_options = nil)
|
182
|
+
available_inputs =
|
183
|
+
config.inputs
|
184
|
+
.slice(*inputs)
|
185
|
+
.each_with_object({}) do |(_, input), inputs|
|
186
|
+
inputs[input.name.to_sym] = Entities::Input.new(input.to_hash)
|
177
187
|
end
|
178
188
|
|
179
|
-
|
180
|
-
|
181
|
-
|
189
|
+
available_inputs.each do |input, current_definition|
|
190
|
+
child_definition = children_available_inputs(selected_suite_options)[input]
|
191
|
+
current_definition.merge_with_child(child_definition)
|
192
|
+
end
|
193
|
+
|
194
|
+
available_inputs = children_available_inputs(selected_suite_options).merge(available_inputs)
|
195
|
+
order_available_inputs(available_inputs)
|
182
196
|
end
|
183
197
|
end
|
184
198
|
end
|
data/lib/inferno/dsl/runnable.rb
CHANGED
@@ -379,7 +379,7 @@ module Inferno
|
|
379
379
|
end
|
380
380
|
|
381
381
|
# @private
|
382
|
-
def test_count(selected_suite_options =
|
382
|
+
def test_count(selected_suite_options = [])
|
383
383
|
@test_counts ||= {}
|
384
384
|
|
385
385
|
@test_counts[selected_suite_options] ||=
|
@@ -395,17 +395,23 @@ module Inferno
|
|
395
395
|
end
|
396
396
|
|
397
397
|
def required_suite_options(suite_option_requirements)
|
398
|
-
@suite_option_requirements =
|
398
|
+
@suite_option_requirements =
|
399
|
+
suite_option_requirements.map do |key, value|
|
400
|
+
DSL::SuiteOption.new(id: key, value: value)
|
401
|
+
end
|
399
402
|
end
|
400
403
|
|
401
|
-
def children(selected_suite_options =
|
404
|
+
def children(selected_suite_options = [])
|
402
405
|
return all_children if selected_suite_options.blank?
|
403
406
|
|
404
407
|
all_children.select do |child|
|
405
|
-
requirements = child.suite_option_requirements
|
408
|
+
requirements = child.suite_option_requirements
|
406
409
|
|
407
|
-
|
408
|
-
|
410
|
+
if requirements.blank?
|
411
|
+
true
|
412
|
+
else
|
413
|
+
requirements.all? { |requirement| selected_suite_options.include? requirement }
|
414
|
+
end
|
409
415
|
end
|
410
416
|
end
|
411
417
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative '../entities/attributes'
|
2
|
+
|
3
|
+
module Inferno
|
4
|
+
module DSL
|
5
|
+
class SuiteOption
|
6
|
+
ATTRIBUTES = [
|
7
|
+
:id,
|
8
|
+
:title,
|
9
|
+
:description,
|
10
|
+
:list_options,
|
11
|
+
:value
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
include Entities::Attributes
|
15
|
+
|
16
|
+
def initialize(raw_params)
|
17
|
+
params = raw_params.deep_symbolize_keys
|
18
|
+
bad_params = params.keys - ATTRIBUTES
|
19
|
+
|
20
|
+
raise Exceptions::UnknownAttributeException.new(bad_params, self.class) if bad_params.present?
|
21
|
+
|
22
|
+
params
|
23
|
+
.compact
|
24
|
+
.each { |key, value| send("#{key}=", value) }
|
25
|
+
|
26
|
+
self.id = id.to_sym if id.is_a? String
|
27
|
+
end
|
28
|
+
|
29
|
+
def ==(other)
|
30
|
+
id == other.id && value == other.value
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_hash
|
34
|
+
self.class::ATTRIBUTES.each_with_object({}) do |attribute, hash|
|
35
|
+
hash[attribute] = send(attribute)
|
36
|
+
end.compact
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -145,10 +145,12 @@ module Inferno
|
|
145
145
|
# Define outputs for this Test
|
146
146
|
#
|
147
147
|
# @param output_definitions [Symbol]
|
148
|
+
# @param _output_params [Hash] Unused parameter. Just makes method
|
149
|
+
# signature compatible with `Inferno::DSL::InputOutputHandling.output`
|
148
150
|
# @return [void]
|
149
151
|
# @example
|
150
152
|
# output :patient_id, :bearer_token
|
151
|
-
def output(*output_definitions)
|
153
|
+
def output(*output_definitions, **_output_params)
|
152
154
|
super
|
153
155
|
|
154
156
|
output_definitions.each do |output|
|
@@ -31,12 +31,12 @@ module Inferno
|
|
31
31
|
Inferno::Repositories::TestGroups.new
|
32
32
|
end
|
33
33
|
|
34
|
-
def groups
|
35
|
-
|
34
|
+
def groups(options = nil)
|
35
|
+
children(options).select { |child| child < Inferno::Entities::TestGroup }
|
36
36
|
end
|
37
37
|
|
38
|
-
def tests
|
39
|
-
|
38
|
+
def tests(options = nil)
|
39
|
+
children(options).select { |child| child < Inferno::Entities::Test }
|
40
40
|
end
|
41
41
|
|
42
42
|
# Methods to configure Inferno::DSL::Runnable
|
@@ -37,6 +37,34 @@ module Inferno
|
|
37
37
|
|
38
38
|
def initialize(params)
|
39
39
|
super(params, ATTRIBUTES)
|
40
|
+
|
41
|
+
self.suite_options ||= []
|
42
|
+
|
43
|
+
test_suite.suite_options&.each do |option|
|
44
|
+
if suite_options.none? { |selected_option| selected_option.id == option.id }
|
45
|
+
suite_options << DSL::SuiteOption.new(id: option.id, value: option.list_options.first[:value])
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_suite
|
51
|
+
@test_suite ||= Repositories::TestSuites.new.find(test_suite_id)
|
52
|
+
end
|
53
|
+
|
54
|
+
def to_hash
|
55
|
+
session_hash = (self.class::ATTRIBUTES - [:suite_options]).each_with_object({}) do |attribute, hash|
|
56
|
+
hash[attribute] = send(attribute)
|
57
|
+
end
|
58
|
+
|
59
|
+
session_hash[:suite_options] = suite_options&.map(&:to_hash) || []
|
60
|
+
|
61
|
+
session_hash.compact
|
62
|
+
end
|
63
|
+
|
64
|
+
def suite_options_hash
|
65
|
+
(suite_options || []).each_with_object({}) do |option, hash|
|
66
|
+
hash[option.id] = option.value
|
67
|
+
end
|
40
68
|
end
|
41
69
|
end
|
42
70
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require_relative 'test_group'
|
2
2
|
require_relative '../dsl/runnable'
|
3
|
+
require_relative '../dsl/suite_option'
|
3
4
|
require_relative '../repositories/test_groups'
|
4
5
|
require_relative '../repositories/test_suites'
|
5
6
|
|
@@ -30,8 +31,8 @@ module Inferno
|
|
30
31
|
Inferno::Repositories::TestSuites.new
|
31
32
|
end
|
32
33
|
|
33
|
-
def groups
|
34
|
-
|
34
|
+
def groups(options = nil)
|
35
|
+
children(options).select { |child| child < Inferno::Entities::TestGroup }
|
35
36
|
end
|
36
37
|
|
37
38
|
# Methods to configure Inferno::DSL::Runnable
|
@@ -86,11 +87,17 @@ module Inferno
|
|
86
87
|
end
|
87
88
|
|
88
89
|
def suite_option(identifier, **input_params)
|
89
|
-
suite_options
|
90
|
+
suite_options << DSL::SuiteOption.new(input_params.merge(id: identifier))
|
90
91
|
end
|
91
92
|
|
92
93
|
def suite_options
|
93
|
-
@suite_options ||=
|
94
|
+
@suite_options ||= []
|
95
|
+
end
|
96
|
+
|
97
|
+
def links(links = nil)
|
98
|
+
return @links if links.nil?
|
99
|
+
|
100
|
+
@links = links
|
94
101
|
end
|
95
102
|
end
|
96
103
|
end
|
Binary file
|