bulk_data_test_kit 0.10.1 → 0.11.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/bulk_data_v101_bulk_data_server.json +43 -0
- data/config/presets/bulk_data_v101_inferno_reference_server.json +43 -0
- data/config/presets/bulk_data_v200_bulk_data_server.json +43 -0
- data/config/presets/bulk_data_v200_inferno_reference_server.json +43 -0
- data/lib/bulk_data_test_kit/igs/put_ig_package_dot_tgz_here +0 -0
- data/lib/bulk_data_test_kit/metadata.rb +45 -0
- data/lib/bulk_data_test_kit/requirements/bulk-data-test-kit_out_of_scope_requirements.csv +1 -0
- data/lib/bulk_data_test_kit/requirements/bulk-data-test-kit_requirements.csv +465 -0
- data/lib/bulk_data_test_kit/requirements/generated/bulk-data-test-kit_requirements_coverage.csv +442 -0
- data/lib/bulk_data_test_kit/requirements/hl7.fhir.uv.bulkdata_2.0.0_reqs.xlsx +0 -0
- data/lib/bulk_data_test_kit/v1.0.1/bulk_data_smart_backend_services_v101_group.rb +21 -0
- data/lib/bulk_data_test_kit/v1.0.1/bulk_data_smart_discovery_v101_contents_test.rb +77 -0
- data/lib/bulk_data_test_kit/v1.0.1/bulk_data_smart_discovery_v101_group.rb +15 -0
- data/lib/bulk_data_test_kit/v1.0.1/bulk_data_test_suite.rb +3 -5
- data/lib/bulk_data_test_kit/{v1.0.1/bulk_data_smart_backend_services_group.rb → v2.0.0/bulk_data_smart_backend_services_v200_group.rb} +3 -3
- data/lib/bulk_data_test_kit/v2.0.0/bulk_data_test_suite.rb +3 -5
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_delete_group.rb +27 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_delete_test.rb +29 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_delete_wait_test.rb +44 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_export_group.rb +31 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_export_wait_test.rb +45 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_kick_off_test.rb +45 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_output_test.rb +28 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_status_test.rb +29 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/bulk_data_client_test_suite.rb +92 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/docs/suite_description.md +33 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/endpoints/delete.rb +22 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/endpoints/kick_off.rb +36 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/endpoints/output.rb +31 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/endpoints/status.rb +39 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/export_types.rb +9 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/postman/delete.postman_collection.json +133 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/postman/system_export.postman_collection.json +181 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/tags.rb +13 -0
- data/lib/bulk_data_test_kit/v2.0.0_client/urls.rb +45 -0
- data/lib/bulk_data_test_kit/version.rb +2 -1
- data/lib/bulk_data_test_kit.rb +3 -1
- data/lib/inferno_requirements_tools/ext/inferno_core/runnable.rb +22 -0
- data/lib/inferno_requirements_tools/rake/rakefile_template +37 -0
- data/lib/inferno_requirements_tools/tasks/collect_requirements.rb +233 -0
- data/lib/inferno_requirements_tools/tasks/requirements_coverage.rb +283 -0
- data/lib/requirements_config.yaml +14 -0
- data/lib/template_requirements_config.yaml +11 -0
- metadata +54 -15
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'pry'
|
2
|
+
module BulkDataTestKit
|
3
|
+
module BulkDataV101
|
4
|
+
class BulkDataSmartDiscoveryV101ContentsTest < Inferno::Test
|
5
|
+
title 'Well-known configuration contains the required fields'
|
6
|
+
id :bulk_data_smart_discovery_v101_contents
|
7
|
+
|
8
|
+
description %(
|
9
|
+
The [Bulk Data v1.0.1 SMART Backend Services IG](https://hl7.org/fhir/uv/bulkdata/STU1.0.1/authorization/index.html#advertising-server-conformance-with-smart-backend-services) states:
|
10
|
+
> A server MAY advertise its conformance with SMART Backend Services, by hosting a Well-Known Uniform Resource
|
11
|
+
> Identifiers (URIs) (RFC5785) JSON document as described at SMART App Launch Authorization Discovery. If
|
12
|
+
> advertising support, a server’s /.well-known/smart-configuration endpoint SHOULD include token_endpoint,
|
13
|
+
> scopes_supported, token_endpoint_auth_methods_supported (with values that include private_key_jwt), and
|
14
|
+
> token_endpoint_auth_signing_alg_values_supported (with values that include at least one of RS384, ES384)
|
15
|
+
> attributes for backend services. The response is a JSON document using the application/json mime type.
|
16
|
+
|
17
|
+
This test requires a valid `token_endpoint` claim to pass but issue a warning for any other recommended claims
|
18
|
+
that are not present.
|
19
|
+
However, any included claim must have the proper format and/or values indicated by the IG.
|
20
|
+
)
|
21
|
+
|
22
|
+
input :well_known_configuration
|
23
|
+
|
24
|
+
output :smart_token_url
|
25
|
+
|
26
|
+
def test_key(config, key, type)
|
27
|
+
assert config[key].present?, "Well-known configuration field `#{key}` is blank"
|
28
|
+
assert config[key].is_a?(type), "Well-known `#{key}` must be type: #{type.to_s.downcase}"
|
29
|
+
end
|
30
|
+
|
31
|
+
run do
|
32
|
+
config = JSON.parse(well_known_configuration)
|
33
|
+
|
34
|
+
# token_endpoint must be output for downstream tests to work
|
35
|
+
assert config.key?('token_endpoint'), 'Well-known configuration does not include `token_endpoint`'
|
36
|
+
test_key(config, 'token_endpoint', String)
|
37
|
+
token_endpoint = config['token_endpoint']
|
38
|
+
assert_valid_http_uri(token_endpoint, "`#{token_endpoint}` is not a valid URI")
|
39
|
+
|
40
|
+
output smart_token_url: token_endpoint
|
41
|
+
|
42
|
+
recommended_capabilities = [
|
43
|
+
'token_endpoint_auth_methods_supported',
|
44
|
+
'token_endpoint_auth_signing_alg_values_supported',
|
45
|
+
'scopes_supported'
|
46
|
+
]
|
47
|
+
|
48
|
+
present_capabilities = []
|
49
|
+
recommended_capabilities.each do |key|
|
50
|
+
if config.key?(key) then present_capabilities.append(key)
|
51
|
+
else
|
52
|
+
warning do
|
53
|
+
assert config.key?(key), "Well-known configuration does not include `#{key}`"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
present_capabilities.each do |key|
|
59
|
+
test_key(config, key, Array)
|
60
|
+
end
|
61
|
+
|
62
|
+
if present_capabilities.include?('token_endpoint_auth_methods_supported')
|
63
|
+
assert config['token_endpoint_auth_methods_supported'].include?('private_key_jwt'),
|
64
|
+
'`token_endpoint_auth_methods_supported` does not include the value `private_key_jwt`'
|
65
|
+
end
|
66
|
+
|
67
|
+
if present_capabilities.include?('token_endpoint_auth_methods_supported')
|
68
|
+
supports_RS384 = config['token_endpoint_auth_signing_alg_values_supported'].include? 'RS384'
|
69
|
+
supports_ES384 = config['token_endpoint_auth_signing_alg_values_supported'].include? 'ES384'
|
70
|
+
|
71
|
+
assert (supports_RS384 || supports_ES384),
|
72
|
+
'`token_endpoint_auth_signing_alg_values_supported` does not include values for `RS384` or `ES384`'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'smart_app_launch/well_known_endpoint_test'
|
2
|
+
require_relative 'bulk_data_smart_discovery_v101_contents_test'
|
3
|
+
|
4
|
+
module BulkDataTestKit
|
5
|
+
module BulkDataV101
|
6
|
+
class BulkDataSmartDiscoveryV101Group < Inferno::TestGroup
|
7
|
+
title 'SMART on FHIR Discovery'
|
8
|
+
id :bulk_data_smart_discovery_v101
|
9
|
+
run_as_group
|
10
|
+
|
11
|
+
test from: :well_known_endpoint
|
12
|
+
test from: :bulk_data_smart_discovery_v101_contents
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../version'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'bulk_data_smart_backend_services_v101_group'
|
5
5
|
require_relative 'bulk_data_export_tests_test_group'
|
6
6
|
|
7
7
|
module BulkDataTestKit
|
8
8
|
module BulkDataV101
|
9
9
|
class BulkDataTestSuite < Inferno::TestSuite
|
10
|
-
title 'Bulk Data Access v1.0.1'
|
11
|
-
version VERSION
|
10
|
+
title 'Bulk Data Access v1.0.1 Server'
|
12
11
|
id :bulk_data_v101
|
13
12
|
links [
|
14
13
|
{
|
@@ -158,8 +157,7 @@ module BulkDataTestKit
|
|
158
157
|
url :bulk_server_url
|
159
158
|
end
|
160
159
|
|
161
|
-
group from: :
|
162
|
-
id: :bulk_data_smart_backend_services_v101
|
160
|
+
group from: :bulk_data_smart_backend_services_v101
|
163
161
|
|
164
162
|
group from: :bulk_data_export_tests_v101
|
165
163
|
end
|
@@ -3,10 +3,10 @@
|
|
3
3
|
require 'smart_app_launch/smart_stu2_suite'
|
4
4
|
|
5
5
|
module BulkDataTestKit
|
6
|
-
module
|
7
|
-
class
|
6
|
+
module BulkDataV200
|
7
|
+
class BulkDataSmartBackendServicesV200Group < Inferno::TestGroup
|
8
8
|
title 'SMART Backend Services'
|
9
|
-
id :
|
9
|
+
id :bulk_data_smart_backend_services_v200
|
10
10
|
run_as_group
|
11
11
|
optional
|
12
12
|
|
@@ -1,14 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../version'
|
4
|
-
require_relative '
|
4
|
+
require_relative 'bulk_data_smart_backend_services_v200_group'
|
5
5
|
require_relative 'bulk_data_export_tests_test_group'
|
6
6
|
|
7
7
|
module BulkDataTestKit
|
8
8
|
module BulkDataV200
|
9
9
|
class BulkDataTestSuite < Inferno::TestSuite
|
10
|
-
title 'Bulk Data Access v2.0.0'
|
11
|
-
version VERSION
|
10
|
+
title 'Bulk Data Access v2.0.0 Server'
|
12
11
|
id :bulk_data_v200
|
13
12
|
links [
|
14
13
|
{
|
@@ -156,8 +155,7 @@ module BulkDataTestKit
|
|
156
155
|
url :bulk_server_url
|
157
156
|
end
|
158
157
|
|
159
|
-
group from: :
|
160
|
-
id: :bulk_data_smart_backend_services_v200
|
158
|
+
group from: :bulk_data_smart_backend_services_v200
|
161
159
|
|
162
160
|
group from: :bulk_data_export_tests_v200
|
163
161
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'bulk_data_client_delete_wait_test'
|
4
|
+
require_relative 'bulk_data_client_kick_off_test'
|
5
|
+
require_relative 'bulk_data_client_delete_test'
|
6
|
+
|
7
|
+
module BulkDataTestKit
|
8
|
+
module BulkDataV200Client
|
9
|
+
# Bulk Data Client Delete Tests
|
10
|
+
class DeleteGroup < Inferno::TestGroup
|
11
|
+
title 'Bulk Data Client Delete Tests'
|
12
|
+
|
13
|
+
description %(
|
14
|
+
The Bulk Data Client Delete tests verify the ability of a client to delete
|
15
|
+
a kicked-off bulk data export request.
|
16
|
+
)
|
17
|
+
|
18
|
+
id :bulk_data_client_delete_group
|
19
|
+
|
20
|
+
run_as_group
|
21
|
+
|
22
|
+
test from: :bulk_data_client_delete_wait
|
23
|
+
test from: :bulk_data_client_kick_off
|
24
|
+
test from: :bulk_data_client_delete
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
# Bulk Data Client - Delete
|
6
|
+
class DeleteTest < Inferno::Test
|
7
|
+
title 'Bulk Data Delete Request'
|
8
|
+
|
9
|
+
description %(
|
10
|
+
This test verifies that after a Bulk Data request has been started, the client can send a
|
11
|
+
DELETE request to the URL provided in the Content-Location header to
|
12
|
+
[delete the request](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-delete-request),
|
13
|
+
as described in the [FHIR Asynchronous Request Pattern](https://www.hl7.org/fhir/R4/async.html).
|
14
|
+
)
|
15
|
+
|
16
|
+
id :bulk_data_client_delete
|
17
|
+
|
18
|
+
verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@119'
|
19
|
+
|
20
|
+
run do
|
21
|
+
assert load_tagged_requests(DELETE_TAG).any?, fail_message
|
22
|
+
end
|
23
|
+
|
24
|
+
def fail_message
|
25
|
+
'Did not receive a delete request.'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
# Bulk Data Client - Delete Wait
|
6
|
+
class DeleteWaitTest < Inferno::Test
|
7
|
+
include URLs
|
8
|
+
|
9
|
+
title 'Wait For Request Sequence'
|
10
|
+
|
11
|
+
description %(
|
12
|
+
This test will receive bulk data export requests until the user confirms they are finished.
|
13
|
+
)
|
14
|
+
|
15
|
+
id :bulk_data_client_delete_wait
|
16
|
+
|
17
|
+
input :access_token, :export_type, :group_id
|
18
|
+
|
19
|
+
run do
|
20
|
+
wait(
|
21
|
+
identifier: access_token,
|
22
|
+
message: %(
|
23
|
+
Kick-off a **#{export_type}** endpoint type bulk export using the following base URL:
|
24
|
+
|
25
|
+
#{kickoff_url}
|
26
|
+
|
27
|
+
#{export_type == GROUP_EXPORT_TYPE ? "Ensure the Group ID is set to **#{group_id}**." : ''}
|
28
|
+
|
29
|
+
Include the following bearer access token with all requests: **#{access_token}**
|
30
|
+
|
31
|
+
Once the export request has been kicked-off,
|
32
|
+
[delete the export](https://build.fhir.org/ig/HL7/bulk-data/export.html#bulk-data-delete-request).
|
33
|
+
|
34
|
+
The entire request sequence will be recorded and used in the subsequent tests to
|
35
|
+
verify comformity to the
|
36
|
+
[Bulk Data IG](https://build.fhir.org/ig/HL7/bulk-data/export.html#sequence-overview).
|
37
|
+
|
38
|
+
[Click here](#{resume_pass_url}?id=#{access_token}) when finished.
|
39
|
+
)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'bulk_data_client_export_wait_test'
|
4
|
+
require_relative 'bulk_data_client_kick_off_test'
|
5
|
+
require_relative 'bulk_data_client_status_test'
|
6
|
+
require_relative 'bulk_data_client_output_test'
|
7
|
+
|
8
|
+
module BulkDataTestKit
|
9
|
+
module BulkDataV200Client
|
10
|
+
# Bulk Data Client Export Tests
|
11
|
+
class ExportGroup < Inferno::TestGroup
|
12
|
+
title 'Bulk Data Client Export Tests'
|
13
|
+
|
14
|
+
description %(
|
15
|
+
The Bulk Data Client Export tests verify the ability of a client to:
|
16
|
+
- Kick-off a new bulk data export request
|
17
|
+
- Poll the in-progress request for status updates
|
18
|
+
- Download a completed bulk data export file
|
19
|
+
)
|
20
|
+
|
21
|
+
id :bulk_data_client_export_group
|
22
|
+
|
23
|
+
run_as_group
|
24
|
+
|
25
|
+
test from: :bulk_data_client_export_wait
|
26
|
+
test from: :bulk_data_client_kick_off
|
27
|
+
test from: :bulk_data_client_status
|
28
|
+
test from: :bulk_data_client_output
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
# Bulk Data Client - Export Wait
|
6
|
+
class ExportWaitTest < Inferno::Test
|
7
|
+
include URLs
|
8
|
+
|
9
|
+
title 'Wait For Request Sequence'
|
10
|
+
|
11
|
+
description %(
|
12
|
+
This test will receive bulk data export requests until the user confirms they are finished.
|
13
|
+
)
|
14
|
+
|
15
|
+
id :bulk_data_client_export_wait
|
16
|
+
|
17
|
+
input :access_token, :export_type, :group_id
|
18
|
+
|
19
|
+
run do
|
20
|
+
wait(
|
21
|
+
identifier: access_token,
|
22
|
+
message: %(
|
23
|
+
Perform a **#{export_type}** endpoint type bulk export kick-off using the following base URL:
|
24
|
+
|
25
|
+
#{kickoff_url}
|
26
|
+
|
27
|
+
#{export_type == GROUP_EXPORT_TYPE ? "Ensure the Group ID is set to **#{group_id}**." : ''}
|
28
|
+
|
29
|
+
Include the following bearer access token with all requests: **#{access_token}**
|
30
|
+
|
31
|
+
After the kick-off is made, a subsequent status request (using the URL provided in the response
|
32
|
+
to the kick-off request) and then a download request (using the URL provided in the response to
|
33
|
+
the status request) are expected.
|
34
|
+
|
35
|
+
The entire request sequence will be recorded and used in the subsequent tests to
|
36
|
+
verify comformity to the
|
37
|
+
[Bulk Data IG](https://build.fhir.org/ig/HL7/bulk-data/export.html#sequence-overview).
|
38
|
+
|
39
|
+
[Click here](#{resume_pass_url}?id=#{access_token}) when finished.
|
40
|
+
)
|
41
|
+
)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
# Bulk Data Client Kick-off
|
6
|
+
class KickOffTest < Inferno::Test
|
7
|
+
title 'Bulk Data Kick-off Request'
|
8
|
+
|
9
|
+
description %(
|
10
|
+
This test verifies that a client can
|
11
|
+
[kick-off a Bulk Data request](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#roles)
|
12
|
+
using the `$export` operation against the proper endpoint type.
|
13
|
+
)
|
14
|
+
|
15
|
+
id :bulk_data_client_kick_off
|
16
|
+
|
17
|
+
verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@17'
|
18
|
+
|
19
|
+
input :export_type
|
20
|
+
|
21
|
+
run do
|
22
|
+
case export_type
|
23
|
+
when PATIENT_EXPORT_TYPE
|
24
|
+
assert load_tagged_requests(PATIENT_KICKOFF_TAG).any?, patient_fail_message
|
25
|
+
when GROUP_EXPORT_TYPE
|
26
|
+
assert load_tagged_requests(GROUP_KICKOFF_TAG).any?, group_fail_message
|
27
|
+
when SYSTEM_EXPORT_TYPE
|
28
|
+
assert load_tagged_requests(SYSTEM_KICKOFF_TAG).any?, system_fail_message
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def patient_fail_message
|
33
|
+
'Did not receive a Patient type kick-off request.'
|
34
|
+
end
|
35
|
+
|
36
|
+
def group_fail_message
|
37
|
+
'Did not receive a Group type kick-off request.'
|
38
|
+
end
|
39
|
+
|
40
|
+
def system_fail_message
|
41
|
+
'Did not receive a System type kick-off request.'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
# Bulk Data Client Output
|
6
|
+
class OutputTest < Inferno::Test
|
7
|
+
title 'Bulk Data Output File Request'
|
8
|
+
|
9
|
+
description %(
|
10
|
+
This test verifies that the client, using the URL supplied in the Complete Status response body,
|
11
|
+
can [download](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-output-file-request)
|
12
|
+
the generated Bulk Data file.
|
13
|
+
)
|
14
|
+
|
15
|
+
id :bulk_data_client_output
|
16
|
+
|
17
|
+
verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@200'
|
18
|
+
|
19
|
+
run do
|
20
|
+
assert load_tagged_requests(OUTPUT_TAG).any?, fail_message
|
21
|
+
end
|
22
|
+
|
23
|
+
def fail_message
|
24
|
+
'Did not receive a download request.'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
# Bulk Data Client Status
|
6
|
+
class StatusTest < Inferno::Test
|
7
|
+
title 'Bulk Data Status Request'
|
8
|
+
|
9
|
+
description %(
|
10
|
+
This test verifies that after a Bulk Data request has been started, the client can
|
11
|
+
[poll the status URL](https://hl7.org/fhir/uv/bulkdata/STU2/export.html#bulk-data-status-request)
|
12
|
+
provided in the Content-Location header, as as described in the
|
13
|
+
[FHIR Asynchronous Request Pattern](https://www.hl7.org/fhir/R4/async.html).
|
14
|
+
)
|
15
|
+
|
16
|
+
id :bulk_data_client_status
|
17
|
+
|
18
|
+
verifies_requirements 'hl7.fhir.uv.bulkdata_2.0.0@123'
|
19
|
+
|
20
|
+
run do
|
21
|
+
assert load_tagged_requests(STATUS_TAG).any?, fail_message
|
22
|
+
end
|
23
|
+
|
24
|
+
def fail_message
|
25
|
+
'Did not receive a status request.'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../version'
|
4
|
+
require_relative 'tags'
|
5
|
+
require_relative 'urls'
|
6
|
+
require_relative 'export_types'
|
7
|
+
|
8
|
+
require_relative 'endpoints/delete'
|
9
|
+
require_relative 'endpoints/kick_off'
|
10
|
+
require_relative 'endpoints/output'
|
11
|
+
require_relative 'endpoints/status'
|
12
|
+
|
13
|
+
require_relative 'bulk_data_client_export_group'
|
14
|
+
require_relative 'bulk_data_client_delete_group'
|
15
|
+
|
16
|
+
module BulkDataTestKit
|
17
|
+
module BulkDataV200Client
|
18
|
+
# Bulk Data Access v2.0.0 Client Test Suite
|
19
|
+
class BulkDataClientTestSuite < Inferno::TestSuite
|
20
|
+
title 'Bulk Data Access v2.0.0 Client'
|
21
|
+
|
22
|
+
description File.read(File.join(__dir__, 'docs', 'suite_description.md'))
|
23
|
+
|
24
|
+
id :bulk_data_v200_client
|
25
|
+
|
26
|
+
links [
|
27
|
+
{
|
28
|
+
label: 'Report Issue',
|
29
|
+
url: 'https://github.com/inferno-framework/bulk-data-test-kit/issues/'
|
30
|
+
},
|
31
|
+
{
|
32
|
+
label: 'Open Source',
|
33
|
+
url: 'https://github.com/inferno-framework/bulk-data-test-kit/'
|
34
|
+
},
|
35
|
+
{
|
36
|
+
label: 'Download',
|
37
|
+
url: 'https://github.com/inferno-framework/bulk-data-test-kit/releases'
|
38
|
+
},
|
39
|
+
{
|
40
|
+
label: 'Implementation Guide',
|
41
|
+
url: 'https://hl7.org/fhir/uv/bulkdata/STU2/'
|
42
|
+
}
|
43
|
+
]
|
44
|
+
|
45
|
+
input :access_token,
|
46
|
+
title: 'Access Token',
|
47
|
+
description: 'The access token that will be included in all client requests during testing.'
|
48
|
+
|
49
|
+
input :export_type,
|
50
|
+
title: 'Export Type',
|
51
|
+
description: 'The export endpoint type to test against.',
|
52
|
+
type: 'radio',
|
53
|
+
default: SYSTEM_EXPORT_TYPE,
|
54
|
+
options: {
|
55
|
+
list_options: [
|
56
|
+
{
|
57
|
+
label: 'All Patients',
|
58
|
+
value: PATIENT_EXPORT_TYPE
|
59
|
+
},
|
60
|
+
{
|
61
|
+
label: 'Group of Patients',
|
62
|
+
value: GROUP_EXPORT_TYPE
|
63
|
+
},
|
64
|
+
{
|
65
|
+
label: 'System Level Export',
|
66
|
+
value: SYSTEM_EXPORT_TYPE
|
67
|
+
}
|
68
|
+
]
|
69
|
+
}
|
70
|
+
|
71
|
+
input :group_id,
|
72
|
+
title: 'Group ID',
|
73
|
+
description: 'If using the Group endpoint, the identifier of the Group to export.',
|
74
|
+
default: 1,
|
75
|
+
locked: true
|
76
|
+
|
77
|
+
suite_endpoint :get, PATIENT_KICKOFF_ROUTE, Endpoints::KickOff
|
78
|
+
suite_endpoint :get, GROUP_KICKOFF_ROUTE, Endpoints::KickOff
|
79
|
+
suite_endpoint :get, SYSTEM_KICKOFF_ROUTE, Endpoints::KickOff
|
80
|
+
suite_endpoint :get, STATUS_ROUTE, Endpoints::Status
|
81
|
+
suite_endpoint :get, OUTPUT_ROUTE, Endpoints::Output
|
82
|
+
suite_endpoint :delete, STATUS_ROUTE, Endpoints::Delete
|
83
|
+
|
84
|
+
resume_test_route :get, RESUME_PASS_PATH do |request|
|
85
|
+
request.query_parameters['id']
|
86
|
+
end
|
87
|
+
|
88
|
+
group from: :bulk_data_client_export_group
|
89
|
+
group from: :bulk_data_client_delete_group
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
The Bulk Data Access v2.0.0 Client test suite validates the conformance of a client
|
2
|
+
to the [FHIR Bulk Data Access IG STU2](http://hl7.org/fhir/uv/bulkdata/STU2).
|
3
|
+
|
4
|
+
## Scope
|
5
|
+
|
6
|
+
These tests are a **DRAFT** intended to allow implementers to perform
|
7
|
+
preliminary checks of their systems against the requirements stated for Bulk Data client actors
|
8
|
+
and [provide feedback](https://github.com/inferno-framework/bulk-data-test-kit/issues)
|
9
|
+
on the tests. Future versions of these tests may verify other
|
10
|
+
requirements and may change the test verification logic.
|
11
|
+
|
12
|
+
## Running the Tests
|
13
|
+
|
14
|
+
### Quick Start
|
15
|
+
|
16
|
+
Inferno needs to be able to identify when requests come from the client under test. Testers must provide a bearer access token that will be provided within the Authentication header (Bearer <token>) on all requests made to Inferno endpoints during the test. Inferno uses this information to associate the message with the test session and determine how to respond. How the token provided to Inferno is generated is up to the tester.
|
17
|
+
|
18
|
+
Note: authentication options for these tests have not been finalized and are subject to change as the requirements evolve. If the implemented approach prevents you from using these tests, please provide feedback so the limitations can be addressed.
|
19
|
+
|
20
|
+
### Sample Execution - Postman
|
21
|
+
|
22
|
+
To try out these tests without a Bulk Data client implementation, you may
|
23
|
+
run them using [this "bulk data client system export" Postman collection](https://github.com/inferno-framework/bulk-data-test-kit/blob/main/lib/bulk_data_test_kit/v2.0.0_client/postman/system_export.postman_collection.json) and [this "bulk data client delete" Postman collection](https://github.com/inferno-framework/bulk-data-test-kit/blob/main/lib/bulk_data_test_kit/v2.0.0_client/postman/delete.postman_collection.json).
|
24
|
+
|
25
|
+
To run client tests against one of the Postman collections:
|
26
|
+
1. Start an Inferno session of the Bulk Data Client test suite.
|
27
|
+
2. Navigate to either the export tests group or the delete tests group (depending on which Postman collection you want to use).
|
28
|
+
3. Click the "Run Tests" button in the upper right, enter any value (e.g. `SAMPLE_TOKEN`) as the access token, and select the "System Level Export" option for export type.
|
29
|
+
4. Click the "Submit" button. The simulated server will then be waiting for an interaction.
|
30
|
+
5. Open Postman and import the relevant Postman collection.
|
31
|
+
6. Set the `access_token` variable equal to the value entered in step 3 (the value is also displayed on the test modal in the Inferno UI for reference).
|
32
|
+
7. Run the collection.
|
33
|
+
8. Once the postman collection has run, click the "Click here" link in the wait dialog to evaluate the requests.
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
module Endpoints
|
6
|
+
# Delete Endpoint
|
7
|
+
class Delete < Inferno::DSL::SuiteEndpoint
|
8
|
+
def test_run_identifier
|
9
|
+
request.get_header('HTTP_AUTHORIZATION')&.split&.last
|
10
|
+
end
|
11
|
+
|
12
|
+
def make_response
|
13
|
+
response.status = 202
|
14
|
+
end
|
15
|
+
|
16
|
+
def tags
|
17
|
+
[DELETE_TAG]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
module Endpoints
|
6
|
+
# Kick Off Endpoint
|
7
|
+
class KickOff < Inferno::DSL::SuiteEndpoint
|
8
|
+
include URLs
|
9
|
+
|
10
|
+
def test_run_identifier
|
11
|
+
request.get_header('HTTP_AUTHORIZATION')&.split&.last
|
12
|
+
end
|
13
|
+
|
14
|
+
def make_response
|
15
|
+
response.status = 202
|
16
|
+
response.headers['Content-Location'] = status_url
|
17
|
+
end
|
18
|
+
|
19
|
+
def tags
|
20
|
+
case request_type.titleize
|
21
|
+
when PATIENT_EXPORT_TYPE
|
22
|
+
[PATIENT_KICKOFF_TAG]
|
23
|
+
when GROUP_EXPORT_TYPE
|
24
|
+
[GROUP_KICKOFF_TAG]
|
25
|
+
when SYSTEM_EXPORT_TYPE
|
26
|
+
[SYSTEM_KICKOFF_TAG]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def request_type
|
31
|
+
request.params[:type] || SYSTEM_EXPORT_TYPE
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BulkDataTestKit
|
4
|
+
module BulkDataV200Client
|
5
|
+
module Endpoints
|
6
|
+
# Output Endpoint
|
7
|
+
class Output < Inferno::DSL::SuiteEndpoint
|
8
|
+
def test_run_identifier
|
9
|
+
request.get_header('HTTP_AUTHORIZATION')&.split&.last
|
10
|
+
end
|
11
|
+
|
12
|
+
def make_response
|
13
|
+
response.status = 200
|
14
|
+
response.headers['Content-Type'] = 'application/fhir+ndjson'
|
15
|
+
response.body = "#{example_patient.to_json.squish}\n"
|
16
|
+
end
|
17
|
+
|
18
|
+
def tags
|
19
|
+
[OUTPUT_TAG]
|
20
|
+
end
|
21
|
+
|
22
|
+
def example_patient
|
23
|
+
FHIR::Patient.new(
|
24
|
+
id: test_run_identifier,
|
25
|
+
name: FHIR::HumanName.new(given: 'Example', family: 'Patient')
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|