inferno_core 0.3.4 → 0.3.5
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_sessions/create.rb +7 -3
- data/lib/inferno/apps/web/router.rb +5 -0
- data/lib/inferno/apps/web/serializers/suite_option.rb +13 -0
- data/lib/inferno/apps/web/serializers/test_group.rb +6 -2
- data/lib/inferno/apps/web/serializers/test_session.rb +5 -3
- data/lib/inferno/apps/web/serializers/test_suite.rb +4 -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/input_output_handling.rb +20 -0
- data/lib/inferno/dsl/runnable.rb +12 -6
- data/lib/inferno/dsl/suite_option.rb +40 -0
- 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 +5 -4
- data/lib/inferno/public/bundle.js +15 -15
- 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 +22 -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: 40fa8983d93a7fc191a7d03bdb78c0bd80e138cfe5245d377c15f28360fb6b03
|
4
|
+
data.tar.gz: 4aa592411c216c13bc55ebcef30ce2019522cc3575edc184fcb10593eb28239a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0f7e9aafced3a1181cd40d8638f4ac07fefc0239ab771b85ce22aaec3785b7328ca82969cd83b1617051201fa149272ba80a53a05789129e6ee35302cf3a1b
|
7
|
+
data.tar.gz: 5f14e0db2c0a2d3238198600a736790ea549ea11c91bb84578dda2e3de2270c31cb314b44972ec2fbc6635aa77b93f0ce4df2926d45c072745b19a1d6371b34f
|
@@ -3,9 +3,13 @@ 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
|
+
query_params = raw_params.to_h
|
10
|
+
body_params = JSON.parse(request.body.string).symbolize_keys
|
11
|
+
params = query_params.merge(body_params)
|
7
12
|
|
8
|
-
def call(params)
|
9
13
|
session = repo.create(create_params(params))
|
10
14
|
|
11
15
|
repo.apply_preset(session.id, params[:preset_id]) if params[:preset_id].present?
|
@@ -21,7 +25,7 @@ module Inferno
|
|
21
25
|
end
|
22
26
|
|
23
27
|
def create_params(params)
|
24
|
-
params.
|
28
|
+
params.slice(*PARAMS)
|
25
29
|
end
|
26
30
|
end
|
27
31
|
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
|
@@ -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
|
@@ -15,8 +15,12 @@ module Inferno
|
|
15
15
|
field :user_runnable?, name: :user_runnable
|
16
16
|
field :optional?, name: :optional
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
field :test_groups do |group, options|
|
19
|
+
TestGroup.render_as_hash(group.groups(options[:suite_options]))
|
20
|
+
end
|
21
|
+
field :tests do |group, options|
|
22
|
+
Test.render_as_hash(group.tests(options[:suite_options]))
|
23
|
+
end
|
20
24
|
field :available_inputs, name: :inputs, extractor: HashValueExtractor, blueprint: Input
|
21
25
|
field :output_definitions, name: :outputs, extractor: HashValueExtractor
|
22
26
|
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,12 +11,15 @@ module Inferno
|
|
11
11
|
field :input_instructions
|
12
12
|
field :test_count
|
13
13
|
field :version
|
14
|
+
association :suite_options, blueprint: SuiteOption
|
14
15
|
association :presets, view: :summary, blueprint: Preset
|
15
16
|
end
|
16
17
|
|
17
18
|
view :full do
|
18
19
|
include_view :summary
|
19
|
-
|
20
|
+
field :test_groups do |suite, options|
|
21
|
+
TestGroup.render_as_hash(suite.groups(options[:suite_options]))
|
22
|
+
end
|
20
23
|
field :configuration_messages
|
21
24
|
field :available_inputs, name: :inputs, extractor: HashValueExtractor, blueprint: Input
|
22
25
|
end
|
data/lib/inferno/db/schema.rb
CHANGED
@@ -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
|
|
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,11 @@ 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 ||= []
|
94
95
|
end
|
95
96
|
end
|
96
97
|
end
|