subscriptions_test_kit 0.9.3 → 0.10.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/subscription_client_empty_preset.json.erb +15 -0
- data/config/presets/subscription_client_full_resource_preset.json.erb +15 -0
- data/config/presets/subscription_client_id_only_preset.json.erb +15 -0
- data/config/presets/subscription_server_preset_empty.json.erb +23 -0
- data/config/presets/subscription_server_preset_full_resource.json.erb +23 -0
- data/config/presets/subscription_server_preset_id_only.json.erb +23 -0
- data/lib/subscriptions_test_kit/common/notification_conformance_verification.rb +8 -11
- data/lib/subscriptions_test_kit/common/subscription_conformance_verification.rb +28 -7
- data/lib/subscriptions_test_kit/docs/samples/Subscription_empty.json +2 -2
- data/lib/subscriptions_test_kit/docs/samples/Subscription_full-resource.json +2 -2
- data/lib/subscriptions_test_kit/docs/samples/Subscription_id-only.json +2 -2
- data/lib/subscriptions_test_kit/docs/subscriptions_r5_backport_r4_client_suite_description.md +7 -1
- data/lib/subscriptions_test_kit/docs/subscriptions_r5_backport_r4_server_suite_description.md +11 -1
- data/lib/subscriptions_test_kit/endpoints/subscription_status_endpoint.rb +6 -5
- data/lib/subscriptions_test_kit/igs/.keep +0 -0
- data/lib/subscriptions_test_kit/jobs/send_subscription_notifications.rb +7 -2
- data/lib/subscriptions_test_kit/metadata.rb +92 -0
- data/lib/subscriptions_test_kit/requirements/generated/subscriptions-test-kit_requirements_coverage.csv +29 -29
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/common/subscription_simulation_utils.rb +43 -15
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/notification_input_payload_verification_test.rb +14 -8
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/notification_input_verification_test.rb +7 -5
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/subscription_verification_test.rb +1 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/interaction_test.rb +8 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow_group.rb +12 -6
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client_suite.rb +3 -3
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction/creation_response_conformance_test.rb +1 -1
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction/notification_delivery_test.rb +5 -5
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction/subscription_conformance_test.rb +15 -21
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction_group.rb +3 -3
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction_verification/notification_conformance_test.rb +38 -22
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction_verification/notification_presence_test.rb +56 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction_verification_group.rb +7 -3
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/subscription_creation.rb +11 -2
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/full_resource_content/full_resource_conformance_test.rb +1 -2
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/id_only_content/id_only_conformance_test.rb +1 -2
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification_group.rb +4 -3
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/handshake_heartbeat/handshake_conformance_test.rb +3 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/handshake_heartbeat/heartbeat_conformance_test.rb +3 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/handshake_heartbeat_group.rb +1 -1
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_endpoint_test.rb +65 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_payload_combo_test.rb +76 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_type_test.rb +68 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_cross_version_extension_test.rb +59 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_filter_test.rb +66 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_payload_type_test.rb +66 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_topic_test.rb +64 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection_group.rb +14 -2
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/workflow_group.rb +4 -4
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server_suite.rb +0 -2
- data/lib/subscriptions_test_kit/version.rb +2 -1
- data/lib/subscriptions_test_kit.rb +1 -0
- metadata +23 -7
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscriptions_test.rb +0 -185
@@ -8,30 +8,29 @@ module SubscriptionsTestKit
|
|
8
8
|
id :subscriptions_r4_server_subscription_conformance
|
9
9
|
title '[USER INPUT VERIFICATION] Verify Subscription to Send to Server'
|
10
10
|
description %(
|
11
|
-
The Subscription resource is used to request notifications for a specific client about a specific topic
|
12
|
-
Conceptually, a subscription is a concrete request for a single client to receive notifications per a single
|
13
|
-
topic. In order to support topic-based subscriptions in R4, this guide defines several extensions for use on the
|
14
|
-
[R4 Subscription resource](http://hl7.org/fhir/R4/subscription.html). A list of extensions defined by this guide
|
15
|
-
can be found on the
|
16
|
-
[Subscriptions R5 Backport IG's Artifacts page](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/artifacts.html#5).
|
17
|
-
|
18
11
|
This test accepts a Subscription resource as an input and verifies that it is conformant to the
|
19
|
-
[R4/B Topic-Based Subscription profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription.html)
|
12
|
+
[R4/B Topic-Based Subscription profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription.html)
|
13
|
+
and that it is constructed to make supported notifications to Inferno's simulated
|
14
|
+
Subscriptions client.
|
20
15
|
|
21
|
-
|
22
|
-
|
16
|
+
For the server to successfuly deliver notifications recognized by this test session, the Subscription `channel`
|
17
|
+
element should have it's subelements populated with the following information:
|
18
|
+
- The `endpoint` field must be set to
|
23
19
|
`#{Inferno::Application['base_url']}/custom/subscriptions_r5_backport_r4_server#{SUBSCRIPTION_CHANNEL_PATH}`.
|
24
20
|
The test will add the correct url to this field if it is not properly set.
|
25
|
-
|
21
|
+
- The `type` element must be set to `rest-hook`, as the Inferno subscription workflow tests use a `rest-hook`
|
26
22
|
subscription channel to receive incoming notifications. The test will add the correct type to this field if it
|
27
23
|
is not properly set.
|
28
|
-
|
29
|
-
|
30
|
-
-
|
31
|
-
|
24
|
+
- The `payload` element should be `application/fhir+json`. Inferno will update it to that value
|
25
|
+
unless the provided value is `application/json`, which Inferno also supports receiving as the
|
26
|
+
`content-type` HTTP header on notifications.
|
27
|
+
- The `header` element must include the `Authorization` header with a Bearer token set to the inputted Inferno
|
28
|
+
access token to direct the server to send that header to identify the notifications are for this session.
|
29
|
+
Inferno will add the entry if it is not present.
|
32
30
|
)
|
33
31
|
|
34
32
|
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@72',
|
33
|
+
'hl7.fhir.uv.subscriptions_1.1.0@73',
|
35
34
|
'hl7.fhir.uv.subscriptions_1.1.0@86'
|
36
35
|
|
37
36
|
input :subscription_resource,
|
@@ -54,17 +53,12 @@ module SubscriptionsTestKit
|
|
54
53
|
sent to Inferno.
|
55
54
|
)
|
56
55
|
|
57
|
-
output :updated_subscription
|
56
|
+
output :updated_subscription
|
58
57
|
|
59
58
|
run do
|
60
59
|
omit_if subscription_resource.blank?, 'Did not input a Subscription resource of this type.'
|
61
60
|
subscription = subscription_verification(subscription_resource)
|
62
61
|
no_error_verification('Subscription resource is not conformant.')
|
63
|
-
|
64
|
-
assert(subscription['criteria'].present?,
|
65
|
-
'The `criteria` field SHALL be populated and contain the canonical URL for the Subscription Topic.')
|
66
|
-
output subscription_topic: subscription['criteria']
|
67
|
-
|
68
62
|
subscription = server_check_channel(subscription, access_token)
|
69
63
|
output updated_subscription: subscription.to_json
|
70
64
|
end
|
@@ -9,9 +9,9 @@ module SubscriptionsTestKit
|
|
9
9
|
title 'Subscription Workflow Interaction'
|
10
10
|
description %(
|
11
11
|
Verify that the Subscription instance the tester provided is conformant, and then demonstrate the ability of the
|
12
|
-
server under test to accept a request for the creation of a FHIR Subscription instance and deliver
|
13
|
-
|
14
|
-
|
12
|
+
server under test to accept a request for the creation of a FHIR Subscription instance and deliver
|
13
|
+
notifications for that Subscription. Inferno will act as a client, creating the Subscription and waiting for
|
14
|
+
notifications based on it.
|
15
15
|
)
|
16
16
|
|
17
17
|
run_as_group
|
@@ -6,7 +6,7 @@ module SubscriptionsTestKit
|
|
6
6
|
include NotificationConformanceVerification
|
7
7
|
|
8
8
|
id :subscriptions_r4_server_notification_conformance
|
9
|
-
title 'Subscription Notification Verification'
|
9
|
+
title 'Subscription Event Notification Verification'
|
10
10
|
description %(
|
11
11
|
As described in [Topic-Based Subscription Components](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/components.html#subscription-notifications),
|
12
12
|
all notifications are enclosed in a Bundle with the type of history. Additionally, the first entry of the bundle
|
@@ -14,9 +14,11 @@ module SubscriptionsTestKit
|
|
14
14
|
[Backport SubscriptionStatus Profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-status-r4.html)
|
15
15
|
in FHIR R4.
|
16
16
|
|
17
|
-
This test takes the received notification bundle
|
17
|
+
This test takes the received event notification bundle or bundles from the most recently successfully created
|
18
|
+
Subscription (from the just-run interaction test) and ensures they are conformant to the
|
18
19
|
[R4 Topic-Based Subscription Notification Bundle](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html)
|
19
|
-
profle.
|
20
|
+
profle. Note that other interactions like handshake and heartbeat notification are not verified as a
|
21
|
+
part of this test and those requests will not be associated with this test.
|
20
22
|
)
|
21
23
|
|
22
24
|
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@14',
|
@@ -37,36 +39,50 @@ module SubscriptionsTestKit
|
|
37
39
|
subscription_requests =
|
38
40
|
requests
|
39
41
|
.select { |request| request.status == 201 }
|
40
|
-
skip_if subscription_requests.empty?,
|
41
|
-
|
42
|
+
skip_if subscription_requests.empty?, %(
|
43
|
+
No successful Subscription creation request of type #{subscription_type}
|
44
|
+
was made in the previous test.
|
45
|
+
)
|
42
46
|
else
|
43
47
|
all_requests = load_tagged_requests('subscription_creation')
|
44
|
-
|
48
|
+
subscription_requests =
|
45
49
|
all_requests
|
46
50
|
.select { |request| request.status == 201 }
|
47
|
-
skip_if
|
51
|
+
skip_if subscription_requests.empty?,
|
48
52
|
'No successful Subscription creation request was made in the previous test.'
|
49
|
-
subscription_requests = [all_subscription_requests.first]
|
50
53
|
end
|
51
54
|
|
55
|
+
# select the most recent subscription to verify
|
56
|
+
# this test is run as part of the interaction group, so the most recent
|
57
|
+
# successfully created Subscription will be the one that came during
|
58
|
+
# the previoius interaction test
|
59
|
+
latest_subscription = nil
|
52
60
|
subscription_requests.each do |subscription_request|
|
53
|
-
|
54
|
-
|
61
|
+
if latest_subscription.blank? || latest_subscription.created_at < subscription_request.created_at
|
62
|
+
latest_subscription = subscription_request
|
63
|
+
end
|
64
|
+
end
|
55
65
|
|
56
|
-
|
57
|
-
|
66
|
+
assert_valid_json(latest_subscription.response_body)
|
67
|
+
subscription = JSON.parse(latest_subscription.response_body)
|
58
68
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
69
|
+
requests = load_tagged_requests('event-notification', subscription['id'])
|
70
|
+
skip_if requests.empty?, %(
|
71
|
+
No event-notification requests were made for Subscription #{subscription['id']}
|
72
|
+
in during the interaction.
|
73
|
+
)
|
74
|
+
|
75
|
+
requests = requests.uniq(&:request_body)
|
76
|
+
requests.each do |request|
|
77
|
+
notification_verification(
|
78
|
+
request.request_body,
|
79
|
+
'event-notification',
|
80
|
+
subscription_id: subscription['id'],
|
81
|
+
status: 'active'
|
82
|
+
)
|
68
83
|
end
|
69
|
-
|
84
|
+
|
85
|
+
no_error_verification("Received event-notifications for Subscription #{subscription['id']} are not conformant.")
|
70
86
|
end
|
71
87
|
end
|
72
88
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module SubscriptionsTestKit
|
2
|
+
module SubscriptionsR5BackportR4Server
|
3
|
+
class NotificationPresenceTest < Inferno::Test
|
4
|
+
id :subscriptions_r4_server_notification_presence
|
5
|
+
title 'Notification Presence Verification'
|
6
|
+
description %(
|
7
|
+
This test identifies the most recent successfully created Subscription (from the just-run interaction test)
|
8
|
+
and checks that the server sent at least one notification to Inferno's notification endpoint
|
9
|
+
regarding that Subscription. This test does not check the types of these notifications or
|
10
|
+
whether they are conformant.
|
11
|
+
)
|
12
|
+
|
13
|
+
def subscription_type
|
14
|
+
config.options[:subscription_type]
|
15
|
+
end
|
16
|
+
|
17
|
+
run do
|
18
|
+
if subscription_type.present?
|
19
|
+
requests = load_tagged_requests('subscription_creation', subscription_type)
|
20
|
+
subscription_requests =
|
21
|
+
requests
|
22
|
+
.select { |request| request.status == 201 }
|
23
|
+
skip_if subscription_requests.empty?, %(
|
24
|
+
No successful Subscription creation request of type #{subscription_type}
|
25
|
+
was made in the previous test.
|
26
|
+
)
|
27
|
+
else
|
28
|
+
all_requests = load_tagged_requests('subscription_creation')
|
29
|
+
subscription_requests =
|
30
|
+
all_requests
|
31
|
+
.select { |request| request.status == 201 }
|
32
|
+
skip_if subscription_requests.empty?,
|
33
|
+
'No successful Subscription creation request was made in the previous test.'
|
34
|
+
end
|
35
|
+
|
36
|
+
# select the most recent subscription to verify
|
37
|
+
# this test is run as part of the interaction group, so the most recent
|
38
|
+
# successfully created Subscription will be the one that came during
|
39
|
+
# the previoius interaction test
|
40
|
+
latest_subscription = nil
|
41
|
+
subscription_requests.each do |subscription_request|
|
42
|
+
if latest_subscription.blank? || latest_subscription.created_at < subscription_request.created_at
|
43
|
+
latest_subscription = subscription_request
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
assert_valid_json(latest_subscription.response_body)
|
48
|
+
subscription = JSON.parse(latest_subscription.response_body)
|
49
|
+
|
50
|
+
requests = load_tagged_requests(subscription['id'])
|
51
|
+
assert !requests.empty?,
|
52
|
+
"No notifications were received from the server related to Subscription #{subscription['id']}."
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require_relative 'interaction_verification/notification_conformance_test'
|
2
|
+
require_relative 'interaction_verification/notification_presence_test'
|
2
3
|
|
3
4
|
module SubscriptionsTestKit
|
4
5
|
module SubscriptionsR5BackportR4Server
|
@@ -6,13 +7,16 @@ module SubscriptionsTestKit
|
|
6
7
|
id :subscriptions_r4_server_interaction_verification
|
7
8
|
title 'Subscription Workflow Interaction Verification'
|
8
9
|
description %(
|
9
|
-
Inferno
|
10
|
-
|
11
|
-
|
10
|
+
Inferno will verify that the sever communicated at least one notification
|
11
|
+
(handshake, heartbeat, and/or event-notification) back to Inferno
|
12
|
+
related to the created Subscription and that that set of notifications
|
13
|
+
includes a conformant event-notification. Other types of notifications
|
14
|
+
are verified during other tests.
|
12
15
|
)
|
13
16
|
|
14
17
|
run_as_group
|
15
18
|
|
19
|
+
test from: :subscriptions_r4_server_notification_presence
|
16
20
|
test from: :subscriptions_r4_server_notification_conformance
|
17
21
|
end
|
18
22
|
end
|
@@ -16,6 +16,12 @@ module SubscriptionsTestKit
|
|
16
16
|
field_path.reduce(subscription) { |obj, path| obj[path] }
|
17
17
|
end
|
18
18
|
|
19
|
+
def normalize_value(value)
|
20
|
+
return value.deep_transform_keys(&:to_sym) if value.is_a?(Hash)
|
21
|
+
|
22
|
+
value
|
23
|
+
end
|
24
|
+
|
19
25
|
def send_unsupported_subscription(subscription, unsupported_type, field_paths, subscription_field_old_values)
|
20
26
|
fhir_operation('/Subscription', body: subscription)
|
21
27
|
|
@@ -27,7 +33,10 @@ module SubscriptionsTestKit
|
|
27
33
|
altered_field = false
|
28
34
|
field_paths.each_with_index do |field_path, index|
|
29
35
|
subscription_field_new_value = get_new_subscription_value(new_subscription, field_path)
|
30
|
-
|
36
|
+
new_value = normalize_value(subscription_field_new_value)
|
37
|
+
old_value = normalize_value(subscription_field_old_values[index])
|
38
|
+
|
39
|
+
if new_value != old_value
|
31
40
|
altered_field = true
|
32
41
|
break
|
33
42
|
end
|
@@ -56,7 +65,7 @@ module SubscriptionsTestKit
|
|
56
65
|
|
57
66
|
fhir_operation('/Subscription', body: subscription, tags:)
|
58
67
|
assert_response_status(201)
|
59
|
-
|
68
|
+
json_parse(request.response_body)
|
60
69
|
end
|
61
70
|
end
|
62
71
|
end
|
@@ -54,11 +54,10 @@ module SubscriptionsTestKit
|
|
54
54
|
requests = load_tagged_requests('event-notification', subscription['id'])
|
55
55
|
skip_if requests.empty?, 'No event-notification requests were made in a previous test as expected.'
|
56
56
|
|
57
|
-
criteria_resource_type = subscription_criteria(subscription)
|
58
57
|
requests = requests.uniq(&:request_body)
|
59
58
|
|
60
59
|
requests.each do |request|
|
61
|
-
full_resource_event_notification_verification(request.request_body,
|
60
|
+
full_resource_event_notification_verification(request.request_body, nil)
|
62
61
|
end
|
63
62
|
end
|
64
63
|
no_error_verification('Received notification-events are not conformant.')
|
@@ -52,11 +52,10 @@ module SubscriptionsTestKit
|
|
52
52
|
requests = load_tagged_requests('event-notification', subscription['id'])
|
53
53
|
skip_if requests.empty?, 'No event-notification requests were made in a previous test as expected.'
|
54
54
|
|
55
|
-
criteria_resource_type = subscription_criteria(subscription)
|
56
55
|
requests = requests.uniq(&:request_body)
|
57
56
|
|
58
57
|
requests.each do |request|
|
59
|
-
id_only_event_notification_verification(request.request_body,
|
58
|
+
id_only_event_notification_verification(request.request_body, nil)
|
60
59
|
end
|
61
60
|
end
|
62
61
|
no_error_verification('Received notification-events are not conformant.')
|
@@ -6,12 +6,13 @@ module SubscriptionsTestKit
|
|
6
6
|
module SubscriptionsR5BackportR4Server
|
7
7
|
class EventNotificationGroup < Inferno::TestGroup
|
8
8
|
id :subscriptions_r4_server_event_notification
|
9
|
-
title 'Backport Subscription Notification Verification'
|
9
|
+
title 'Backport Subscription Notification Payload Type Verification'
|
10
10
|
description %(
|
11
11
|
Verify that the received Notifications are conformant to the
|
12
12
|
[R4 Topic-Based Subscription Notification Bundle](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html)
|
13
|
-
profile, including additional requirements around the
|
14
|
-
options available when specifying the
|
13
|
+
profile, including additional requirements around the payload type. This group contains tests for the three
|
14
|
+
options available when specifying the content level for event notification payloads:
|
15
|
+
`empty`, `id-only`, and `full-resource`.
|
15
16
|
)
|
16
17
|
|
17
18
|
input_order :url, :credentials, :access_token, :empty_subscription_resource,
|
@@ -13,6 +13,9 @@ module SubscriptionsTestKit
|
|
13
13
|
endpoint. After a successful handshake notification has been sent and accepted, the server SHALL update the
|
14
14
|
status to active. This test verifies that the incoming handshake request is a conformant
|
15
15
|
[R4 Topic-Based Subscription Notification Bundle](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html).
|
16
|
+
|
17
|
+
Note that all Subscriptions and the associated Handshake notifications received during previously-run tests
|
18
|
+
will be associated with this test and analyzed for conformance.
|
16
19
|
)
|
17
20
|
|
18
21
|
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@14',
|
@@ -11,6 +11,9 @@ module SubscriptionsTestKit
|
|
11
11
|
When a Subscription is created for a REST Hook channel type, the server Server may send notifications of type
|
12
12
|
heartbeat at any time. This test verifies that the incoming heartbeat request is a conformant
|
13
13
|
[R4 Topic-Based Subscription Notification Bundle](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html).
|
14
|
+
|
15
|
+
Note that all Subscriptions and the associated Heartbeat notifications received during previously-run tests
|
16
|
+
will be associated with this test and analyzed for conformance.
|
14
17
|
)
|
15
18
|
|
16
19
|
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@14',
|
@@ -7,7 +7,7 @@ module SubscriptionsTestKit
|
|
7
7
|
id :subscriptions_r4_server_handshake_heartbeat
|
8
8
|
title 'Backport Subscription Handshake and Heartbeat Notification Verification'
|
9
9
|
description %(
|
10
|
-
Verify that
|
10
|
+
Verify that all Handshake ane Heartbeat Notifications received during previous tests are conformant to the
|
11
11
|
[R4 Topic-Based Subscription Notification Bundle](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html)
|
12
12
|
profile.
|
13
13
|
)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionChannelEndpointTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_channel_endpoint
|
9
|
+
title 'Server Handles Unsupported Subscription Channel Endpoints'
|
10
|
+
description %(
|
11
|
+
When processing a request for a Subscription a server SHOULD verify that the Subscription is supported and does
|
12
|
+
not contain any information not implemented by the server. If the Subscription is not supported, the server
|
13
|
+
should reject the Subscription create request, or it should attempt to adjust the Subscription. When
|
14
|
+
processing a request for a Subscription, a server SHOULD validate that the channel endpoint is valid
|
15
|
+
for the channel provided (e.g., is it a valid URL of the expected type).
|
16
|
+
|
17
|
+
The test will pass if the server either
|
18
|
+
1. rejects the Subscription by responding with a non-201 response, or
|
19
|
+
2. updates the Subscription resource to remove or replace the unsupported value.
|
20
|
+
)
|
21
|
+
|
22
|
+
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@11'
|
23
|
+
|
24
|
+
input :subscription_resource,
|
25
|
+
title: 'Workflow Subscription Resource',
|
26
|
+
type: 'textarea',
|
27
|
+
description: %(
|
28
|
+
A Subscription resource in JSON format that Inferno will send to the server under test
|
29
|
+
so that it can demonstrate its ability to perform the Subscription creation and Notification
|
30
|
+
response workflow. The instance must be conformant to the R4/B Topic-Based Subscription profile.
|
31
|
+
Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
|
32
|
+
This input is also used by the unsupported Subscription test as the base on which to add unsupported
|
33
|
+
element values to test for server rejection.
|
34
|
+
)
|
35
|
+
input :unsupported_subscription_channel_endpoint,
|
36
|
+
title: 'Unsupported Subscription Channel Endpoint',
|
37
|
+
description: 'An unsupported value for the `channel.endpoint` element to test for Subscription rejection.',
|
38
|
+
optional: true
|
39
|
+
|
40
|
+
run do
|
41
|
+
skip_if(unsupported_subscription_channel_endpoint.blank?, %(
|
42
|
+
Provide a value in the "Unsupported Subscription Channel Endpoint" input to run this test.))
|
43
|
+
|
44
|
+
assert_valid_json(subscription_resource)
|
45
|
+
subscription = JSON.parse(subscription_resource)
|
46
|
+
|
47
|
+
unsupported_info = {
|
48
|
+
'unsupported_title' => 'unsupported channel URL',
|
49
|
+
'field_path' => ['channel', 'endpoint'],
|
50
|
+
'field_value' => unsupported_subscription_channel_endpoint
|
51
|
+
}
|
52
|
+
|
53
|
+
field_name = unsupported_info['field_path'].last
|
54
|
+
outer_field_name = unsupported_info['field_path'].first
|
55
|
+
subscription_field = subscription[outer_field_name]
|
56
|
+
subscription_field[field_name] = unsupported_info['field_value']
|
57
|
+
|
58
|
+
send_unsupported_subscription(subscription, unsupported_info['unsupported_title'],
|
59
|
+
[unsupported_info['field_path']], [unsupported_info['field_value']])
|
60
|
+
|
61
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionChannelPayloadComboTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_channel_payload_combo
|
9
|
+
title 'Server Handles Unsupported Subscription Payload for Channel Type'
|
10
|
+
description %(
|
11
|
+
When processing a request for a Subscription a server SHOULD verify that the Subscription is supported and does
|
12
|
+
not contain any information not implemented by the server. If the Subscription is not supported, the server
|
13
|
+
should reject the Subscription create request, or it should attempt to adjust the Subscription. When
|
14
|
+
processing a request for a Subscription, a server SHOULD validate, that the payload configuration is
|
15
|
+
valid for the channel type requested (e.g., complies with the server's security policy).
|
16
|
+
|
17
|
+
The test will pass if the server either
|
18
|
+
1. rejects the Subscription by responding with a non-201 response, or
|
19
|
+
2. updates the Subscription resource to remove or replace the unsupported value.
|
20
|
+
)
|
21
|
+
|
22
|
+
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@13'
|
23
|
+
|
24
|
+
input :subscription_resource,
|
25
|
+
title: 'Workflow Subscription Resource',
|
26
|
+
type: 'textarea',
|
27
|
+
description: %(
|
28
|
+
A Subscription resource in JSON format that Inferno will send to the server under test
|
29
|
+
so that it can demonstrate its ability to perform the Subscription creation and Notification
|
30
|
+
response workflow. The instance must be conformant to the R4/B Topic-Based Subscription profile.
|
31
|
+
Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
|
32
|
+
This input is also used by the unsupported Subscription test as the base on which to add unsupported
|
33
|
+
element values to test for server rejection.
|
34
|
+
)
|
35
|
+
input :unsupported_subscription_channel_payload_combo,
|
36
|
+
title: 'Unsupported Subscription Channel and Payload Combination',
|
37
|
+
description: %(
|
38
|
+
A channel (`channel.type`) and payload type (`content` extension under the `channel.payload` element)
|
39
|
+
combination not implemented by the server to test for Subscription
|
40
|
+
rejection. Provide as a JSON object with two keys as follows: {"channel": "channel_type",
|
41
|
+
"payload": "wrong_payload_type_for_this_channel"}.
|
42
|
+
),
|
43
|
+
optional: true
|
44
|
+
|
45
|
+
run do
|
46
|
+
skip_if(unsupported_subscription_channel_payload_combo.blank?, %(
|
47
|
+
Provide a value in the "Unsupported Subscription Channel and Payload Combination" input to run this test.))
|
48
|
+
|
49
|
+
assert_valid_json(subscription_resource)
|
50
|
+
subscription = JSON.parse(subscription_resource)
|
51
|
+
|
52
|
+
assert_valid_json(unsupported_subscription_channel_payload_combo)
|
53
|
+
channel_payload_combo = JSON.parse(unsupported_subscription_channel_payload_combo)
|
54
|
+
channel_value = channel_payload_combo['channel']
|
55
|
+
payload_value = channel_payload_combo['payload']
|
56
|
+
|
57
|
+
if channel_value.blank? || payload_value.blank?
|
58
|
+
add_message('error', %(Channel and payload values are not populated correctly in unsupported channel and
|
59
|
+
payload combination input.))
|
60
|
+
else
|
61
|
+
subscription_channel = subscription['channel']
|
62
|
+
subscription_channel['type'] = channel_value
|
63
|
+
subscription_channel['payload'] = payload_value
|
64
|
+
|
65
|
+
channel_path = ['channel', 'type']
|
66
|
+
payload_path = ['channel', 'payload']
|
67
|
+
|
68
|
+
send_unsupported_subscription(subscription, 'unsupported channel and payload combination',
|
69
|
+
[channel_path, payload_path], [channel_value, payload_value])
|
70
|
+
end
|
71
|
+
|
72
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionChannelTypeTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_channel_type
|
9
|
+
title 'Server Handles Unsupported Subscription Channel Types'
|
10
|
+
description %(
|
11
|
+
When processing a request for a Subscription a server SHOULD verify that the Subscription is supported and does
|
12
|
+
not contain any information not implemented by the server. If the Subscription is not supported, the server
|
13
|
+
should reject the Subscription create request, or it should attempt to adjust the Subscription. When
|
14
|
+
processing a request for a Subscription a server SHOULD validat that the channel type is known
|
15
|
+
and implemented by the server.
|
16
|
+
|
17
|
+
The test will pass if the server either
|
18
|
+
1. rejects the Subscription by responding with a non-201 response, or
|
19
|
+
2. updates the Subscription resource to remove or replace the unsupported value.
|
20
|
+
)
|
21
|
+
|
22
|
+
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@10'
|
23
|
+
|
24
|
+
input :subscription_resource,
|
25
|
+
title: 'Workflow Subscription Resource',
|
26
|
+
type: 'textarea',
|
27
|
+
description: %(
|
28
|
+
A Subscription resource in JSON format that Inferno will send to the server under test
|
29
|
+
so that it can demonstrate its ability to perform the Subscription creation and Notification
|
30
|
+
response workflow. The instance must be conformant to the R4/B Topic-Based Subscription profile.
|
31
|
+
Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
|
32
|
+
This input is also used by the unsupported Subscription test as the base on which to add unsupported
|
33
|
+
element values to test for server rejection.
|
34
|
+
)
|
35
|
+
input :unsupported_subscription_channel_type,
|
36
|
+
title: 'Unsupported Subscription Channel Type',
|
37
|
+
description: %(A value for the `channel.type` element that is not implemented by the server to test for
|
38
|
+
Subscription rejection.),
|
39
|
+
optional: true
|
40
|
+
|
41
|
+
run do
|
42
|
+
skip_if(unsupported_subscription_channel_type.blank?, %(
|
43
|
+
Provide a value in the "Unsupported Subscription Channel Type" input to run this test.))
|
44
|
+
|
45
|
+
assert_valid_json(subscription_resource)
|
46
|
+
subscription = JSON.parse(subscription_resource)
|
47
|
+
|
48
|
+
unsupported_info = {
|
49
|
+
'unsupported_title' => 'unsupported channel type',
|
50
|
+
'field_path' => ['channel', 'type'],
|
51
|
+
'field_value' => unsupported_subscription_channel_type
|
52
|
+
}
|
53
|
+
|
54
|
+
field_name = unsupported_info['field_path'].last
|
55
|
+
outer_field_name = unsupported_info['field_path'].first
|
56
|
+
subscription_field = subscription[outer_field_name]
|
57
|
+
subscription_field[field_name] = unsupported_info['field_value']
|
58
|
+
|
59
|
+
subscription_field[field_name] = unsupported_info['field_value']
|
60
|
+
|
61
|
+
send_unsupported_subscription(subscription, unsupported_info['unsupported_title'],
|
62
|
+
[unsupported_info['field_path']], [unsupported_info['field_value']])
|
63
|
+
|
64
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionCrossVersionExtensionTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_cross_version_extension
|
9
|
+
title 'Server Handles Unsupported Cross-Version Extensions'
|
10
|
+
description %(
|
11
|
+
When processing a request for a Subscription a server SHOULD verify that the Subscription is supported and does
|
12
|
+
not contain any information not implemented by the server. If the Subscription is not supported, the server
|
13
|
+
should reject the Subscription create request, or it should attempt to adjust the Subscription. Since the FHIR
|
14
|
+
R5 is currently under development, there are no guarantees these extensions will meet the requirements of
|
15
|
+
this guide. In order to promote widespread compatibility, cross version extensions SHOULD NOT be used
|
16
|
+
on R4 subscriptions to describe any elements.
|
17
|
+
|
18
|
+
The test will pass if the server rejects the Subscription by responding with a non-201 response.
|
19
|
+
)
|
20
|
+
|
21
|
+
input :subscription_resource,
|
22
|
+
title: 'Workflow Subscription Resource',
|
23
|
+
type: 'textarea',
|
24
|
+
description: %(
|
25
|
+
A Subscription resource in JSON format that Inferno will send to the server under test
|
26
|
+
so that it can demonstrate its ability to perform the Subscription creation and Notification
|
27
|
+
response workflow. The instance must be conformant to the R4/B Topic-Based Subscription profile.
|
28
|
+
Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
|
29
|
+
This input is also used by the unsupported Subscription test as the base on which to add unsupported
|
30
|
+
element values to test for server rejection.
|
31
|
+
)
|
32
|
+
|
33
|
+
run do
|
34
|
+
assert_valid_json(subscription_resource)
|
35
|
+
subscription = JSON.parse(subscription_resource)
|
36
|
+
|
37
|
+
unsupported_info = {
|
38
|
+
'unsupported_title' => 'cross-version extensions',
|
39
|
+
'field_path' => ['_criteria'],
|
40
|
+
'field_value' => { 'extension' => [{
|
41
|
+
url: 'http://hl7.org/fhir/5.0/subscriptions-backport/StructureDefinition/backport-filter-criteria',
|
42
|
+
valueString: 'Encounter.patient=Patient/123'
|
43
|
+
}] }
|
44
|
+
}
|
45
|
+
|
46
|
+
field_name = unsupported_info['field_path'].last
|
47
|
+
subscription[field_name] = unsupported_info['field_value']
|
48
|
+
|
49
|
+
fhir_operation('/Subscription', body: subscription)
|
50
|
+
if request.status == 201
|
51
|
+
add_message('error', %(
|
52
|
+
Sending a Subscription with #{unsupported_info['unsupported_title']} should be rejected.))
|
53
|
+
end
|
54
|
+
|
55
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|