davinci_pdex_test_kit 0.10.2 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/davinci_pdex_test_kit/mock_server.rb +16 -5
- data/lib/davinci_pdex_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: ab2a6cb356ae224ab504194aba059499028cad59620924a1e241ce3fc6933837
|
4
|
+
data.tar.gz: da42ce6fe75cc1d5556a76608c7e0cf5d023a7ee7a2a32ddabda69556b6ce599
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c98f6d0797b6f4ae1869231aebf919d177f7f493649884dde1d23f13ecb383f37655a484f9b6e5be17f18d8d9182b978f1fe3fac4b07ff59a50ae8aa804b7c
|
7
|
+
data.tar.gz: 7babf6b49a3264283ae8b5a17d0b53b81599fc04b8ffc99fa3f07adf7c3de889f42889f81ab534a97afc21a76ed7434f6e17f384909e081353ada64a34faf789
|
@@ -18,7 +18,9 @@ module DaVinciPDexTestKit
|
|
18
18
|
url: ENV.fetch('FHIR_REFERENCE_SERVER'),
|
19
19
|
params: {},
|
20
20
|
headers: {'Content-Type' => 'application/json', 'Authorization' => 'Bearer SAMPLE_TOKEN', 'Host' => ENV.fetch('HOST_HEADER')},
|
21
|
-
)
|
21
|
+
) do |proxy|
|
22
|
+
proxy.use FaradayMiddleware::Gzip
|
23
|
+
end
|
22
24
|
end
|
23
25
|
|
24
26
|
def token_response(request, _test = nil, _test_result = nil)
|
@@ -34,8 +36,9 @@ module DaVinciPDexTestKit
|
|
34
36
|
response = server_proxy.get(endpoint, params)
|
35
37
|
request.status = response.status
|
36
38
|
response_resource = replace_bundle_urls(FHIR.from_contents(response.body))
|
37
|
-
request.response_headers = response.headers
|
39
|
+
request.response_headers = remove_transfer_encoding_header(response.headers)
|
38
40
|
request.response_body = response_resource.to_json
|
41
|
+
request.response_header("content-length").value = request.response_body.length
|
39
42
|
else
|
40
43
|
response = server_proxy.get('Patient', {_id: 999})
|
41
44
|
response_resource = FHIR.from_contents(response.body)
|
@@ -49,14 +52,14 @@ module DaVinciPDexTestKit
|
|
49
52
|
def read_next_page(request, test = nil, test_result = nil)
|
50
53
|
response = server_proxy.get('', request.query_parameters)
|
51
54
|
request.status = response.status
|
52
|
-
request.response_headers = response.headers
|
55
|
+
request.response_headers = remove_transfer_encoding_header(response.headers)
|
53
56
|
request.response_body = replace_bundle_urls(FHIR.from_contents(response.body)).to_json
|
54
57
|
end
|
55
58
|
|
56
59
|
def everything_response(request, test = nil, test_result = nil)
|
57
60
|
response = server_proxy.get('Patient/999/$everything') #TODO: Change from static response
|
58
61
|
request.status = response.status
|
59
|
-
request.response_headers = response.headers
|
62
|
+
request.response_headers = remove_transfer_encoding_header(response.headers)
|
60
63
|
request.response_body = replace_bundle_urls(FHIR.from_contents(response.body)).to_json
|
61
64
|
end
|
62
65
|
|
@@ -80,7 +83,7 @@ module DaVinciPDexTestKit
|
|
80
83
|
req.headers = headers_as_hash.merge(server_proxy.headers)
|
81
84
|
end
|
82
85
|
request.status = response.status
|
83
|
-
request.response_headers = response.env.response_headers
|
86
|
+
request.response_headers = remove_transfer_encoding_header(response.env.response_headers)
|
84
87
|
request.response_body = response.status.to_i == 200 ? replace_export_urls(JSON.parse(response.body)).to_json : response.body
|
85
88
|
request.response_header("content-length").value = request.response_body.length
|
86
89
|
end
|
@@ -128,6 +131,14 @@ module DaVinciPDexTestKit
|
|
128
131
|
proc { [200, {'Content-Type' => 'application/fhir+json;charset=utf-8'}, [File.read("lib/davinci_pdex_test_kit/metadata/mock_capability_statement.json")]] }
|
129
132
|
end
|
130
133
|
|
134
|
+
def remove_transfer_encoding_header(headers)
|
135
|
+
if !headers["transfer-encoding"].nil?
|
136
|
+
headers.reject!{|key, value| key == "transfer-encoding"}
|
137
|
+
else
|
138
|
+
headers
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
131
142
|
def match_request_to_expectation(endpoint, params)
|
132
143
|
matched_search = SEARCHES_BY_PRIORITY[endpoint.to_sym].find {|expectation| (params.keys.map{|key| key.to_s} & expectation).sort == expectation}
|
133
144
|
# matched_search_without_patient = SEARCHES_BY_PRIORITY[endpoint.to_sym].find {|expectation| (params.keys.map{|key| key.to_s} << "patient" & expectation) == expectation}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: davinci_pdex_test_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Naden
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-07-
|
13
|
+
date: 2024-07-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: inferno_core
|