davinci_pas_test_kit 0.11.0 → 0.12.0
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 +4 -4
- data/config/presets/pas_client_example.json +30 -0
- data/config/presets/pas_ri.json +69 -0
- data/lib/davinci_pas_test_kit/client_suite.rb +11 -27
- data/lib/davinci_pas_test_kit/docs/PAS Requirements Interpretation.xlsx +0 -0
- data/lib/davinci_pas_test_kit/{mock_server.rb → endpoints/claim_endpoint.rb} +32 -45
- data/lib/davinci_pas_test_kit/endpoints/token_endpoint.rb +22 -0
- data/lib/davinci_pas_test_kit/fhir_resource_navigation.rb +3 -3
- data/lib/davinci_pas_test_kit/generated/v2.0.1/server_suite.rb +4 -2
- data/lib/davinci_pas_test_kit/generator/templates/group.rb.erb +129 -0
- data/lib/davinci_pas_test_kit/generator/templates/must_support.rb.erb +73 -0
- data/lib/davinci_pas_test_kit/generator/templates/operation.rb.erb +62 -0
- data/lib/davinci_pas_test_kit/generator/templates/resource_list.rb.erb +13 -0
- data/lib/davinci_pas_test_kit/generator/templates/suite.rb.erb +91 -0
- data/lib/davinci_pas_test_kit/generator/templates/validation.rb.erb +98 -0
- data/lib/davinci_pas_test_kit/generator/templates/validation_client.rb.erb +50 -0
- data/lib/davinci_pas_test_kit/igs/davinci_pas_2.0.1.tgz +0 -0
- data/lib/davinci_pas_test_kit/metadata.rb +87 -0
- data/lib/davinci_pas_test_kit/version.rb +2 -1
- data/lib/davinci_pas_test_kit.rb +1 -0
- metadata +21 -10
- data/lib/davinci_pas_test_kit/ext/inferno_core/record_response_route.rb +0 -98
- data/lib/davinci_pas_test_kit/ext/inferno_core/request.rb +0 -19
- data/lib/davinci_pas_test_kit/ext/inferno_core/runnable.rb +0 -18
@@ -0,0 +1,91 @@
|
|
1
|
+
require_relative '../../validator_suppressions'
|
2
|
+
require_relative '<%= error_group_file_name %>'
|
3
|
+
<% group_file_list.each do |file_name| %>require_relative '<%= file_name %>'
|
4
|
+
<% end %>
|
5
|
+
module DaVinciPASTestKit
|
6
|
+
module <%= module_name %>
|
7
|
+
class <%= class_name %> < Inferno::TestSuite
|
8
|
+
id :<%= suite_id %>
|
9
|
+
title '<%= title %>'
|
10
|
+
description File.read(File.join(__dir__, '..', '..', 'docs', 'server_suite_description_<%= ig_metadata.reformatted_version %>.md'))
|
11
|
+
|
12
|
+
links [
|
13
|
+
{
|
14
|
+
label: 'Report Issue',
|
15
|
+
url: 'https://github.com/inferno-framework/davinci-pas-test-kit/issues/'
|
16
|
+
},
|
17
|
+
{
|
18
|
+
label: 'Open Source',
|
19
|
+
url: 'https://github.com/inferno-framework/davinci-pas-test-kit/'
|
20
|
+
},
|
21
|
+
{
|
22
|
+
label: 'Download',
|
23
|
+
url: 'https://github.com/inferno-framework/davinci-pas-test-kit/releases'
|
24
|
+
},
|
25
|
+
{
|
26
|
+
label: 'Implementation Guide',
|
27
|
+
url: '<%= ig_link %>'
|
28
|
+
}
|
29
|
+
]
|
30
|
+
|
31
|
+
resume_test_route :get, '/resume_after_notification' do |request|
|
32
|
+
request.query_parameters['token']
|
33
|
+
end
|
34
|
+
|
35
|
+
fhir_resource_validator do
|
36
|
+
igs '<%= ig_identifier %>'
|
37
|
+
|
38
|
+
exclude_message do |message|
|
39
|
+
# Messages expected of the form `<ResourceType>: <FHIRPath>: <message>`
|
40
|
+
# We strip `<ResourceType>: <FHIRPath>: ` for the sake of matching
|
41
|
+
SUPPRESSED_MESSAGES.match?(message.message.sub(/\A\S+: \S+: /, '')) ||
|
42
|
+
message.message.downcase.include?('x12')
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
input :server_endpoint,
|
47
|
+
title: 'FHIR Server Endpoint URL',
|
48
|
+
description: 'Insert the FHIR server endpoint URL for PAS'
|
49
|
+
|
50
|
+
input :smart_credentials,
|
51
|
+
title: 'OAuth Credentials',
|
52
|
+
type: :auth_info,
|
53
|
+
options: {
|
54
|
+
mode: 'access',
|
55
|
+
components: [
|
56
|
+
{
|
57
|
+
name: :auth_type,
|
58
|
+
default: 'backend_services'
|
59
|
+
}
|
60
|
+
]
|
61
|
+
},
|
62
|
+
optional: true
|
63
|
+
|
64
|
+
fhir_client do
|
65
|
+
url :server_endpoint
|
66
|
+
auth_info :smart_credentials
|
67
|
+
end
|
68
|
+
|
69
|
+
# Used for attestation experiment - see pas_claim_response_decision_test.rb
|
70
|
+
# resume_test_route :get, RESUME_PASS_PATH do |request|
|
71
|
+
# request.query_parameters['token']
|
72
|
+
# end
|
73
|
+
#
|
74
|
+
# resume_test_route :get, RESUME_FAIL_PATH, result: 'fail' do |request|
|
75
|
+
# request.query_parameters['token']
|
76
|
+
# end
|
77
|
+
|
78
|
+
group 'Demonstrate Workflow Support' do
|
79
|
+
description %(
|
80
|
+
The workflow tests validate that the server can participate in complete
|
81
|
+
end-to-end prior authorization interactions, returning responses that are
|
82
|
+
conformant and also contain the correct codes.
|
83
|
+
)
|
84
|
+
<% group_id_list.each do |id| %>
|
85
|
+
group from: :<%= id %><% end %>
|
86
|
+
end
|
87
|
+
group from: :<%= must_support_group_id %>
|
88
|
+
group from: :<%= error_group_id %>
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
require_relative '../../../pas_bundle_validation'
|
2
|
+
|
3
|
+
module DaVinciPASTestKit
|
4
|
+
module <%= module_name %>
|
5
|
+
class <%= class_name %> < Inferno::Test
|
6
|
+
include DaVinciPASTestKit::PasBundleValidation
|
7
|
+
|
8
|
+
id :<%= test_id %>
|
9
|
+
title '<%= title %>'
|
10
|
+
description %(
|
11
|
+
<%=description.strip.gsub("\n", "\n" + " "*8) %>
|
12
|
+
)
|
13
|
+
<% if request_type.include?('request') %>
|
14
|
+
input :pa_<%= request_type %>_payload,
|
15
|
+
title: 'PAS <%= request_type.humanize.titleize%> Payload',
|
16
|
+
description: 'Insert Bundle to be sent for PAS <%= request_type.humanize.titleize%>',
|
17
|
+
type: 'textarea',
|
18
|
+
optional: true
|
19
|
+
|
20
|
+
input_order :server_endpoint, :smart_credentials<% end %>
|
21
|
+
output :dar_code_found, :dar_extension_found
|
22
|
+
|
23
|
+
def resource_type
|
24
|
+
'<%= resource_type %>'
|
25
|
+
end
|
26
|
+
|
27
|
+
def scratch_resources
|
28
|
+
scratch[:<%= request_type %>_resources] ||= {}
|
29
|
+
end
|
30
|
+
|
31
|
+
def request_type
|
32
|
+
'<%= request_type.split('_').first %>'
|
33
|
+
end
|
34
|
+
<%if request_type.include?('response')%>
|
35
|
+
def target_request_response_pairs<% operation = request_type.split('_').first %>
|
36
|
+
scratch[:<%= operation %>_request_response_pair] ||= {}
|
37
|
+
scratch[:<%= operation %>_request_response_pair][:all] ||= []
|
38
|
+
end<% end %>
|
39
|
+
|
40
|
+
<%if request_type.include?('request')%>
|
41
|
+
def request_bundles
|
42
|
+
parsed_payload = JSON.parse(pa_<%= request_type %>_payload)
|
43
|
+
fhir_resources = [parsed_payload].flatten.compact.uniq.map { |payload| FHIR.from_contents(payload.to_json)}.compact
|
44
|
+
fhir_resources.select { |res| res.resourceType == 'Bundle'}
|
45
|
+
end<% end %>
|
46
|
+
|
47
|
+
run do<% if request_type.include?('request') %>
|
48
|
+
skip_if pa_<%= request_type %>_payload.blank?, 'No bundle request input provided.'
|
49
|
+
assert_valid_json(pa_<%= request_type %>_payload)
|
50
|
+
assert request_bundles.present?, 'Provided input is not a bundle or list of bundles'
|
51
|
+
|
52
|
+
save_bundles_and_entries_to_scratch(request_bundles)
|
53
|
+
|
54
|
+
request_bundles.each do |bundle|
|
55
|
+
perform_request_validation(
|
56
|
+
bundle,
|
57
|
+
'<%= profile_url %>',
|
58
|
+
'<%= profile_version %>',
|
59
|
+
request_type
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
validation_error_messages.each do |msg|
|
64
|
+
messages << { type: 'error', message: msg }
|
65
|
+
end
|
66
|
+
msg = 'Bundle(s) provided and/or entry resources are not conformant. Check messages for issues found.'
|
67
|
+
skip_if validation_error_messages.present?, msg
|
68
|
+
<% else %>
|
69
|
+
skip_if target_request_response_pairs.blank?, 'No <%= request_type.split('_').first%> response to validate. Either no <%= request_type.split('_').first%> request was made in a previous test or it resulted in a server error.'
|
70
|
+
target_pairs = target_request_response_pairs
|
71
|
+
# Clean request/response pair after validatation
|
72
|
+
scratch[:<%= operation %>_request_response_pair][:all] = []
|
73
|
+
|
74
|
+
response_bundles = target_pairs.map { |pair| pair[:response_bundle] }
|
75
|
+
save_bundles_and_entries_to_scratch(response_bundles)
|
76
|
+
|
77
|
+
target_pairs.each do |pair|
|
78
|
+
pair => {request_bundle:, response_bundle:}
|
79
|
+
assert_resource_type(:bundle, resource: response_bundle)
|
80
|
+
|
81
|
+
perform_response_validation(
|
82
|
+
response_bundle,
|
83
|
+
'<%= profile_url %>',
|
84
|
+
'<%= profile_version %>',
|
85
|
+
request_type,
|
86
|
+
request_bundle
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
validation_error_messages.each do |msg|
|
91
|
+
messages << { type: 'error', message: msg }
|
92
|
+
end
|
93
|
+
msg = 'Bundle response returned and/or entry resources are not conformant. Check messages for issues found.'
|
94
|
+
assert validation_error_messages.blank?, msg<% end %>
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require_relative '../../../pas_bundle_validation'
|
2
|
+
require_relative '../../../<% if request_type.include?('response') %>user_input_response'<% else %>urls'<% end %>
|
3
|
+
|
4
|
+
module DaVinciPASTestKit
|
5
|
+
module <%= module_name %>
|
6
|
+
class <%= class_name %> < Inferno::Test
|
7
|
+
include DaVinciPASTestKit::PasBundleValidation
|
8
|
+
include <% if request_type.include?('response') %>UserInputResponse<% else %>URLs<% end %>
|
9
|
+
|
10
|
+
id :<%= test_id %>
|
11
|
+
title '<%= title %>'
|
12
|
+
description %(
|
13
|
+
<%=description.strip.gsub("\n", "\n" + " "*8) %>
|
14
|
+
)
|
15
|
+
|
16
|
+
def resource_type
|
17
|
+
'<%= resource_type %>'
|
18
|
+
end
|
19
|
+
|
20
|
+
def request_type
|
21
|
+
'<%= request_type.split('_').first %>'
|
22
|
+
end
|
23
|
+
|
24
|
+
run do<% if request_type.include?('request') %><% type = request_type.split('_').first == 'submit' ? 'submit' : 'inquire' %>
|
25
|
+
assert request.url == <%= type %>_url,
|
26
|
+
"Request made to wrong URL: #{request.url}. Should instead be to #{<%= type %>_url}"
|
27
|
+
|
28
|
+
validate_pas_bundle_json(
|
29
|
+
request.request_body,
|
30
|
+
'<%= profile_url %>',
|
31
|
+
'<%= profile_version %>',
|
32
|
+
request_type,
|
33
|
+
'request_bundle',
|
34
|
+
message: 'The <%= type%> Bundle request provided for the Claim/$<%= type%> operation is invalid:'
|
35
|
+
)
|
36
|
+
<% else %>
|
37
|
+
check_user_inputted_response :<%= workflow %>_json_response
|
38
|
+
validate_pas_bundle_json(
|
39
|
+
<%= workflow %>_json_response,
|
40
|
+
'<%= profile_url %>',
|
41
|
+
'<%= profile_version %>',
|
42
|
+
request_type,
|
43
|
+
'response_bundle',
|
44
|
+
skips: true,
|
45
|
+
message: "Invalid input for '#{input_title(:<%= workflow %>_json_response)}':"
|
46
|
+
)<% end %>
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
Binary file
|
@@ -0,0 +1,87 @@
|
|
1
|
+
require_relative 'version'
|
2
|
+
|
3
|
+
module DaVinciPASTestKit
|
4
|
+
class Metadata < Inferno::TestKit
|
5
|
+
id :davinci_pas_test_kit
|
6
|
+
title 'Da Vinci Prior Authorization Support (PAS) Test Kit'
|
7
|
+
description <<~DESCRIPTION
|
8
|
+
The Da Vinci Prior Authorization Support (PAS) Test Kit validates
|
9
|
+
the conformance of both PAS client and server implementations to
|
10
|
+
[version 2.0.1 of the Da Vinci PAS Implementation
|
11
|
+
Guide](https://hl7.org/fhir/us/davinci-pas/STU2/).
|
12
|
+
|
13
|
+
<!-- break -->
|
14
|
+
|
15
|
+
To validate the behavior of a system Inferno will act as the partner to the
|
16
|
+
system under test:
|
17
|
+
- **When testing a client**: Inferno will act as a server, awaiting requests
|
18
|
+
from the client under test, returning appropriate responses, and validating
|
19
|
+
the conformance of the client's requests and its ability to handle the
|
20
|
+
responses appropriately.
|
21
|
+
- **When testing a server**: Inferno will act as a client, making requests
|
22
|
+
against the server under test and validating the conformance and
|
23
|
+
appropriateness of the server's responses.
|
24
|
+
|
25
|
+
The test suites for both PAS clients and servers follow the same basic outline,
|
26
|
+
each testing:
|
27
|
+
|
28
|
+
- The implementation's ability to use PAS-defined APIs to participate in the
|
29
|
+
submission of and decision on a prior authorization request, including:
|
30
|
+
- Approval of a prior authorization request.
|
31
|
+
- Denial of a prior authorization request.
|
32
|
+
- Pending of a prior authorization request and a subsequent final decision.
|
33
|
+
- The implementation ability to provide and handle data covering the full scope
|
34
|
+
of PAS must support requirements on:
|
35
|
+
- Prior authorization submissions.
|
36
|
+
- Prior authorization inquiries.
|
37
|
+
|
38
|
+
The Da Vinci PAS Test Kit is built using the [Inferno
|
39
|
+
Framework](https://inferno-framework.github.io/). The Inferno Framework is
|
40
|
+
designed for reuse and aims to make it easier to build test kits for any
|
41
|
+
FHIR-based data exchange.
|
42
|
+
|
43
|
+
## Known Limitations
|
44
|
+
|
45
|
+
The following areas of the IG are not fully tested in this draft version of the test kit:
|
46
|
+
|
47
|
+
- Private X12 details including value set expansions
|
48
|
+
- The use of Subscriptions to alert clients of updates to pended requests
|
49
|
+
- Prior Authorization update workflows
|
50
|
+
- Requests for additional information handled through the CDex framework
|
51
|
+
- PDF, CDA, and JPG attachments
|
52
|
+
- US Core profile support for supporting information
|
53
|
+
- Server inquiry matching and subsetting logic
|
54
|
+
- Server inquiry requests from non-submitting systems
|
55
|
+
- Server collection of metrics
|
56
|
+
- Client handling of responses containing all PAS-defined profiles and must support elements
|
57
|
+
- Client handling of situations that requiring manual review of the client system,
|
58
|
+
e.g., the requirement that clinicians can update details of the prior authorization
|
59
|
+
request before submitting them
|
60
|
+
|
61
|
+
For additional details on these and other areas where the tests may not align with
|
62
|
+
the IGs requirements, see documentation in the test kit source code ([client](https://github.com/inferno-framework/davinci-pas-test-kit/blob/main/lib/davinci_pas_test_kit/docs/client_suite_description_v201.md#testing-limitations), [server](https://github.com/inferno-framework/davinci-pas-test-kit/blob/main/lib/davinci_pas_test_kit/docs/server_suite_description_v201.md#testing-limitations)), and [this requirements analysis
|
63
|
+
spreadsheet](https://github.com/inferno-framework/davinci-pas-test-kit/blob/main/lib/davinci_pas_test_kit/docs/PAS%20Requirements%20Interpretation.xlsx).
|
64
|
+
|
65
|
+
### Known IG Issues
|
66
|
+
|
67
|
+
Through testing with this test kit, issues have been identified in the version of the PAS
|
68
|
+
specification that this test kit tests against which cause false failures. The full list
|
69
|
+
of known issues can be found on the [repository's issues page with the 'source ig issue'
|
70
|
+
lable](https://github.com/inferno-framework/davinci-pas-test-kit/labels/source%20ig%20issue).
|
71
|
+
|
72
|
+
## Reporting Issues
|
73
|
+
|
74
|
+
Please report any issues with this set of tests in the [GitHub
|
75
|
+
Issues](https://github.com/inferno-framework/davinci-pas-test-kit/issues)
|
76
|
+
section of the
|
77
|
+
[open source code repository](https://github.com/inferno-framework/davinci-pas-test-kit).
|
78
|
+
DESCRIPTION
|
79
|
+
suite_ids [:davinci_pas_server_suite_v201, :davinci_pas_client_suite_v201]
|
80
|
+
tags ['Da Vinci', 'PAS']
|
81
|
+
last_updated LAST_UPDATED
|
82
|
+
version VERSION
|
83
|
+
maturity 'Low'
|
84
|
+
authors ['Inferno Team']
|
85
|
+
repo 'https://github.com/inferno-framework/davinci-pas-test-kit'
|
86
|
+
end
|
87
|
+
end
|
data/lib/davinci_pas_test_kit.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: davinci_pas_test_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Inferno Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: database_cleaner-sequel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +88,8 @@ extensions: []
|
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
90
|
- LICENSE
|
91
|
+
- config/presets/pas_client_example.json
|
92
|
+
- config/presets/pas_ri.json
|
91
93
|
- lib/davinci_pas_test_kit.rb
|
92
94
|
- lib/davinci_pas_test_kit/client_suite.rb
|
93
95
|
- lib/davinci_pas_test_kit/custom_groups/v2.0.1/claim_response_decision/pas_claim_response_decision_test.rb
|
@@ -118,11 +120,11 @@ files:
|
|
118
120
|
- lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_denial_group.rb
|
119
121
|
- lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_client_pended_group.rb
|
120
122
|
- lib/davinci_pas_test_kit/custom_groups/v2.0.1/pas_error_group.rb
|
123
|
+
- lib/davinci_pas_test_kit/docs/PAS Requirements Interpretation.xlsx
|
121
124
|
- lib/davinci_pas_test_kit/docs/client_suite_description_v201.md
|
122
125
|
- lib/davinci_pas_test_kit/docs/server_suite_description_v201.md
|
123
|
-
- lib/davinci_pas_test_kit/
|
124
|
-
- lib/davinci_pas_test_kit/
|
125
|
-
- lib/davinci_pas_test_kit/ext/inferno_core/runnable.rb
|
126
|
+
- lib/davinci_pas_test_kit/endpoints/claim_endpoint.rb
|
127
|
+
- lib/davinci_pas_test_kit/endpoints/token_endpoint.rb
|
126
128
|
- lib/davinci_pas_test_kit/fhir_resource_navigation.rb
|
127
129
|
- lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/client_inquire_request_beneficiary_must_support_test.rb
|
128
130
|
- lib/davinci_pas_test_kit/generated/v2.0.1/beneficiary/client_submit_request_beneficiary_must_support_test.rb
|
@@ -244,11 +246,19 @@ files:
|
|
244
246
|
- lib/davinci_pas_test_kit/generator/operation_test_generator.rb
|
245
247
|
- lib/davinci_pas_test_kit/generator/resource_list_generator.rb
|
246
248
|
- lib/davinci_pas_test_kit/generator/suite_generator.rb
|
249
|
+
- lib/davinci_pas_test_kit/generator/templates/group.rb.erb
|
250
|
+
- lib/davinci_pas_test_kit/generator/templates/must_support.rb.erb
|
251
|
+
- lib/davinci_pas_test_kit/generator/templates/operation.rb.erb
|
252
|
+
- lib/davinci_pas_test_kit/generator/templates/resource_list.rb.erb
|
253
|
+
- lib/davinci_pas_test_kit/generator/templates/suite.rb.erb
|
254
|
+
- lib/davinci_pas_test_kit/generator/templates/validation.rb.erb
|
255
|
+
- lib/davinci_pas_test_kit/generator/templates/validation_client.rb.erb
|
247
256
|
- lib/davinci_pas_test_kit/generator/terminology_binding_metadata_extractor.rb
|
248
257
|
- lib/davinci_pas_test_kit/generator/validation_test_generator.rb
|
249
258
|
- lib/davinci_pas_test_kit/generator/value_extractor.rb
|
250
259
|
- lib/davinci_pas_test_kit/igs/README.md
|
251
|
-
- lib/davinci_pas_test_kit/
|
260
|
+
- lib/davinci_pas_test_kit/igs/davinci_pas_2.0.1.tgz
|
261
|
+
- lib/davinci_pas_test_kit/metadata.rb
|
252
262
|
- lib/davinci_pas_test_kit/must_support_test.rb
|
253
263
|
- lib/davinci_pas_test_kit/pas_bundle_validation.rb
|
254
264
|
- lib/davinci_pas_test_kit/tags.rb
|
@@ -261,6 +271,7 @@ homepage: https://github.com/inferno-framework/davinci-pas-test-kit
|
|
261
271
|
licenses:
|
262
272
|
- Apache-2.0
|
263
273
|
metadata:
|
274
|
+
inferno_test_kit: 'true'
|
264
275
|
homepage_uri: https://github.com/inferno-framework/davinci-pas-test-kit
|
265
276
|
source_code_uri: https://github.com/inferno-framework/davinci-pas-test-kit
|
266
277
|
post_install_message:
|
@@ -271,14 +282,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
271
282
|
requirements:
|
272
283
|
- - ">="
|
273
284
|
- !ruby/object:Gem::Version
|
274
|
-
version: 3.
|
285
|
+
version: 3.3.6
|
275
286
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
276
287
|
requirements:
|
277
288
|
- - ">="
|
278
289
|
- !ruby/object:Gem::Version
|
279
290
|
version: '0'
|
280
291
|
requirements: []
|
281
|
-
rubygems_version: 3.
|
292
|
+
rubygems_version: 3.5.22
|
282
293
|
signing_key:
|
283
294
|
specification_version: 4
|
284
295
|
summary: Da Vinci PAS Test Kit
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require 'hanami/controller'
|
2
|
-
|
3
|
-
module Inferno
|
4
|
-
module DSL
|
5
|
-
# A base class for creating routes with custom response logic. Requests and responses are tagged and saved.
|
6
|
-
# @private
|
7
|
-
# @see Inferno::DSL::Runnable#resume_test_route
|
8
|
-
class RecordResponseRoute < Hanami::Action
|
9
|
-
include Import[
|
10
|
-
requests_repo: 'inferno.repositories.requests',
|
11
|
-
results_repo: 'inferno.repositories.results',
|
12
|
-
test_runs_repo: 'inferno.repositories.test_runs',
|
13
|
-
tests_repo: 'inferno.repositories.tests'
|
14
|
-
]
|
15
|
-
|
16
|
-
def self.call(...)
|
17
|
-
new.call(...)
|
18
|
-
end
|
19
|
-
|
20
|
-
# @private
|
21
|
-
def test_run_identifier_block
|
22
|
-
self.class.singleton_class.instance_variable_get(:@test_run_identifier_block)
|
23
|
-
end
|
24
|
-
|
25
|
-
# @private
|
26
|
-
def build_response_block
|
27
|
-
self.class.singleton_class.instance_variable_get(:@build_response_block)
|
28
|
-
end
|
29
|
-
|
30
|
-
# @private
|
31
|
-
def tags
|
32
|
-
self.class.singleton_class.instance_variable_get(:@tags)
|
33
|
-
end
|
34
|
-
|
35
|
-
# @private
|
36
|
-
def resumes?(test)
|
37
|
-
instance_exec(test, &self.class.singleton_class.instance_variable_get(:@resumes))
|
38
|
-
end
|
39
|
-
|
40
|
-
# @private
|
41
|
-
def find_test_run(test_run_identifier)
|
42
|
-
test_runs_repo.find_latest_waiting_by_identifier(test_run_identifier)
|
43
|
-
end
|
44
|
-
|
45
|
-
# @private
|
46
|
-
def find_waiting_result(test_run)
|
47
|
-
results_repo.find_waiting_result(test_run_id: test_run.id)
|
48
|
-
end
|
49
|
-
|
50
|
-
# @private
|
51
|
-
def update_result(waiting_result)
|
52
|
-
results_repo.update_result(waiting_result.id, 'pass')
|
53
|
-
end
|
54
|
-
|
55
|
-
# @private
|
56
|
-
def persist_request(request, test_run, waiting_result, test)
|
57
|
-
requests_repo.create(
|
58
|
-
request.to_hash.merge(
|
59
|
-
test_session_id: test_run.test_session_id,
|
60
|
-
result_id: waiting_result.id,
|
61
|
-
name: test.config.request_name(test.incoming_request_name),
|
62
|
-
tags:
|
63
|
-
)
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
# @private
|
68
|
-
def find_test(waiting_result)
|
69
|
-
tests_repo.find(waiting_result.test_id)
|
70
|
-
end
|
71
|
-
|
72
|
-
# @private
|
73
|
-
def handle(req, res)
|
74
|
-
request = Inferno::Entities::Request.from_hanami_request(req)
|
75
|
-
|
76
|
-
test_run_identifier = instance_exec(request, &test_run_identifier_block)
|
77
|
-
|
78
|
-
test_run = find_test_run(test_run_identifier)
|
79
|
-
|
80
|
-
halt 500, "Unable to find test run with identifier '#{test_run_identifier}'." if test_run.nil?
|
81
|
-
|
82
|
-
waiting_result = find_waiting_result(test_run)
|
83
|
-
test = find_test(waiting_result)
|
84
|
-
|
85
|
-
test_runs_repo.mark_as_no_longer_waiting(test_run.id) if resumes? test
|
86
|
-
|
87
|
-
update_result(waiting_result) if resumes? test
|
88
|
-
|
89
|
-
instance_exec(request, test, waiting_result, &build_response_block)
|
90
|
-
|
91
|
-
Inferno::Entities::Request.to_hanami_response(request, res)
|
92
|
-
persist_request(request, test_run, waiting_result, test)
|
93
|
-
|
94
|
-
Jobs.perform(Jobs::ResumeTestRun, test_run.id) if resumes? test
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Inferno
|
2
|
-
module Entities
|
3
|
-
class Request
|
4
|
-
def self.to_hanami_response(request, response)
|
5
|
-
response.status = request.status
|
6
|
-
response.body = request.response_body
|
7
|
-
request.response_headers.each do |header|
|
8
|
-
response.headers[header.name] = header.value
|
9
|
-
end
|
10
|
-
|
11
|
-
response
|
12
|
-
end
|
13
|
-
|
14
|
-
def response_headers=(headers_hash)
|
15
|
-
headers.concat(headers_hash.map { |key, value| Header.new(name: key.to_s, value:, type: 'response') })
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require_relative 'record_response_route'
|
2
|
-
|
3
|
-
module Inferno
|
4
|
-
module DSL
|
5
|
-
module Runnable
|
6
|
-
def record_response_route(method, path, tags, build_response, resumes: ->(_) { true }, &block)
|
7
|
-
route_class = Class.new(Inferno::DSL::RecordResponseRoute) do |klass|
|
8
|
-
klass.singleton_class.instance_variable_set(:@build_response_block, build_response)
|
9
|
-
klass.singleton_class.instance_variable_set(:@test_run_identifier_block, block)
|
10
|
-
klass.singleton_class.instance_variable_set(:@tags, Array.wrap(tags))
|
11
|
-
klass.singleton_class.instance_variable_set(:@resumes, resumes)
|
12
|
-
end
|
13
|
-
|
14
|
-
route(method, path, route_class)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|