davinci_pas_test_kit 0.9.2 → 0.9.3
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/lib/davinci_pas_test_kit/custom_groups/v2.0.1/client_tests/pas_client_approval_submit_response_attest.rb +1 -0
- data/lib/davinci_pas_test_kit/docs/client_suite_description_v201.md +5 -0
- data/lib/davinci_pas_test_kit/mock_server.rb +21 -3
- data/lib/davinci_pas_test_kit/pas_bundle_validation.rb +1 -1
- data/lib/davinci_pas_test_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7207f98c62ccfb04612a2d98d93623e1d76fd8085527c7876aac18ac84682ac
|
4
|
+
data.tar.gz: 818e6468ac830e23ce7f060556d36a3f62ebf133af0604c6b0123e9afdd286f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 822cbab62106199fd7d870ee149bba4a5d7303ae1937b2d4b6ef44d5b208f55fc2809dd373bc584b6562fa2908d113d4fd0164e0bd82a4cf87116433450ac36e
|
7
|
+
data.tar.gz: 8186c2bd0d8b3d407f220969d90f339725d8f09863f0d01172a95813ef5fd4dfd99790486ff826189b13d8d43aad353d6b43d5d04aba2a02bb7824a223f5add1
|
@@ -77,6 +77,11 @@ json-encoded FHIR bundle in the "Claim pended response JSON" and "Claim deny res
|
|
77
77
|
clicking the '*Run All Tests*' button. These responses will be echoed back when a request
|
78
78
|
is made during the corresponding test.
|
79
79
|
|
80
|
+
Selecting the *Example PAS Server Responses* Preset in the dropdown in the upper left will fill in example
|
81
|
+
FHIR bundles for the pended and deny responses. It will also fill in a sample value for the Client ID,
|
82
|
+
which is only necessary for the *Demonstrate Authorization* test group, which can be skipped in favor of
|
83
|
+
manual bearer token input in subsequent tests as described above.
|
84
|
+
|
80
85
|
### Postman-based Demo
|
81
86
|
|
82
87
|
If you do not have a PAS client but would like to try the tests out, you can use
|
@@ -25,9 +25,13 @@ module DaVinciPASTestKit
|
|
25
25
|
operation = request&.url&.split('$')&.last
|
26
26
|
req_bundle = FHIR.from_contents(request&.request_body)
|
27
27
|
claim_entry = req_bundle&.entry&.find { |e| e&.resource&.resourceType == 'Claim' }
|
28
|
-
|
29
|
-
|
28
|
+
claim_full_url = claim_entry&.fullUrl
|
29
|
+
if claim_entry.blank? || claim_full_url.blank?
|
30
|
+
handle_missing_required_elements(claim_entry, request)
|
31
|
+
return
|
32
|
+
end
|
30
33
|
|
34
|
+
root_url = base_url(claim_full_url)
|
31
35
|
claim_response = mock_claim_response(claim_entry.resource, req_bundle, operation, root_url)
|
32
36
|
|
33
37
|
res_bundle = FHIR::Bundle.new(
|
@@ -137,11 +141,25 @@ module DaVinciPASTestKit
|
|
137
141
|
request.query_parameters['token']
|
138
142
|
end
|
139
143
|
|
144
|
+
def handle_missing_required_elements(claim_entry, request)
|
145
|
+
request.status = 400
|
146
|
+
request.response_headers = { 'Content-Type': 'application/json' }
|
147
|
+
details = if claim_entry.blank?
|
148
|
+
'Required Claim entry missing from bundle'
|
149
|
+
else
|
150
|
+
'Required element fullUrl missing from Claim entry'
|
151
|
+
end
|
152
|
+
request.response_body = FHIR::OperationOutcome.new(
|
153
|
+
issue: FHIR::OperationOutcome::Issue.new(severity: 'fatal', code: 'required',
|
154
|
+
details: FHIR::CodeableConcept.new(text: details))
|
155
|
+
).to_json
|
156
|
+
end
|
157
|
+
|
140
158
|
# Drop the last two segments of a URL, i.e. the resource type and ID of a FHIR resource
|
141
159
|
# e.g. http://example.org/fhir/Patient/123 -> http://example.org/fhir
|
142
160
|
# @private
|
143
161
|
def base_url(url)
|
144
|
-
return unless url
|
162
|
+
return unless url&.start_with?('http://', 'https://')
|
145
163
|
|
146
164
|
# Drop everything after the second to last '/', ignoring a trailing slash
|
147
165
|
url.sub(%r{/[^/]*/[^/]*(/)?\z}, '')
|
@@ -465,7 +465,7 @@ module DaVinciPASTestKit
|
|
465
465
|
url_regex = /\A#{URI::DEFAULT_PARSER.make_regexp(%w[http https])}\z/
|
466
466
|
urn_uuid_regex = /\Aurn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}\z/i
|
467
467
|
|
468
|
-
string
|
468
|
+
string&.match?(url_regex) || string&.match?(urn_uuid_regex)
|
469
469
|
end
|
470
470
|
|
471
471
|
# This method traverses references within a FHIR resource, ensuring that referenced resources
|
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.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Inferno Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|