subscriptions_test_kit 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/subscriptions_test_kit/common/notification_conformance_verification.rb +7 -10
- data/lib/subscriptions_test_kit/common/subscription_conformance_verification.rb +14 -2
- data/lib/subscriptions_test_kit/docs/samples/Subscription_empty.json +1 -1
- data/lib/subscriptions_test_kit/docs/samples/Subscription_full-resource.json +1 -1
- data/lib/subscriptions_test_kit/docs/samples/Subscription_id-only.json +1 -1
- data/lib/subscriptions_test_kit/docs/subscriptions_r5_backport_r4_client_suite_description.md +4 -1
- data/lib/subscriptions_test_kit/docs/subscriptions_r5_backport_r4_server_suite_description.md +4 -1
- data/lib/subscriptions_test_kit/endpoints/subscription_status_endpoint.rb +3 -2
- data/lib/subscriptions_test_kit/jobs/send_subscription_notifications.rb +7 -2
- data/lib/subscriptions_test_kit/requirements/generated/subscriptions-test-kit_requirements_coverage.csv +7 -7
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/common/subscription_simulation_utils.rb +41 -13
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/notification_input_payload_verification_test.rb +14 -7
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/notification_input_verification_test.rb +7 -4
- 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 +1 -0
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction/subscription_conformance_test.rb +2 -6
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/subscription_creation.rb +10 -1
- 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/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/version.rb +1 -1
- metadata +9 -3
- data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscriptions_test.rb +0 -185
@@ -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
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionFilterTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_filter
|
9
|
+
title 'Server Handles Unsupported Subscription Filters'
|
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 all requested filters are
|
15
|
+
defined in the requested topic and are implemented in 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@9'
|
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_filter,
|
36
|
+
title: 'Unsupported Subscription Filter',
|
37
|
+
description: %(A value for `filterCriteria` extension under the `criteria` that is not implemented by the
|
38
|
+
server to test for Subscription rejection.),
|
39
|
+
optional: true
|
40
|
+
|
41
|
+
run do
|
42
|
+
skip_if(unsupported_subscription_filter.blank?, %(
|
43
|
+
Provide a value in the "Unsupported Subscription Filter" 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 filter criteria',
|
50
|
+
'field_path' => ['_criteria'],
|
51
|
+
'field_value' => { 'extension' => [{
|
52
|
+
url: 'http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-filter-criteria',
|
53
|
+
valueString: unsupported_subscription_filter
|
54
|
+
}] }
|
55
|
+
}
|
56
|
+
|
57
|
+
field_name = unsupported_info['field_path'].last
|
58
|
+
subscription[field_name] = unsupported_info['field_value']
|
59
|
+
send_unsupported_subscription(subscription, unsupported_info['unsupported_title'],
|
60
|
+
[unsupported_info['field_path']], [unsupported_info['field_value']])
|
61
|
+
|
62
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionPayloadTypeTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_payload_type
|
9
|
+
title 'Server Handles Unsupported Subscription Payload 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 validate that the payload configuration is
|
15
|
+
known 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@12'
|
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_payload_type,
|
36
|
+
title: 'Unsupported Subscription Payload Type',
|
37
|
+
description: %(A value for the `content` extension under the `channel.payload` element that is not
|
38
|
+
implemented by the server to test for Subscription rejection.),
|
39
|
+
optional: true
|
40
|
+
|
41
|
+
run do
|
42
|
+
skip_if(unsupported_subscription_payload_type.blank?, %(
|
43
|
+
Provide a value in the "Unsupported Subscription Payload 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 payload type',
|
50
|
+
'field_path' => ['channel', 'payload'],
|
51
|
+
'field_value' => unsupported_subscription_payload_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
|
+
send_unsupported_subscription(subscription, unsupported_info['unsupported_title'],
|
60
|
+
[unsupported_info['field_path']], [unsupported_info['field_value']])
|
61
|
+
|
62
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require_relative '../common/subscription_creation'
|
2
|
+
|
3
|
+
module SubscriptionsTestKit
|
4
|
+
module SubscriptionsR5BackportR4Server
|
5
|
+
class RejectSubscriptionTopicTest < Inferno::Test
|
6
|
+
include SubscriptionCreation
|
7
|
+
|
8
|
+
id :subscriptions_r4_server_reject_subscription_topic
|
9
|
+
title 'Server Handles Unsupported Subscription Topics'
|
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 SubscriptionTopic is
|
15
|
+
valid 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@8'
|
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_topic,
|
36
|
+
title: 'Unsupported Subscription Topic',
|
37
|
+
description: %(A Subscription Topic for the `criteria` element that is not implemented by the server to test
|
38
|
+
for Subscription rejection.),
|
39
|
+
optional: true
|
40
|
+
|
41
|
+
run do
|
42
|
+
skip_if(unsupported_subscription_topic.blank?, %(
|
43
|
+
Provide a value in the "Unsupported Subscription Topic" 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 `SubscriptionTopic`',
|
50
|
+
'field_path' => ['criteria'],
|
51
|
+
'field_value' => unsupported_subscription_topic
|
52
|
+
}
|
53
|
+
|
54
|
+
field_name = unsupported_info['field_path'].last
|
55
|
+
subscription[field_name] = unsupported_info['field_value']
|
56
|
+
|
57
|
+
send_unsupported_subscription(subscription, unsupported_info['unsupported_title'],
|
58
|
+
[unsupported_info['field_path']], [unsupported_info['field_value']])
|
59
|
+
|
60
|
+
no_error_verification('Unsupported Subscription creation error handling failures.')
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -1,4 +1,10 @@
|
|
1
|
-
require_relative 'subscription_rejection/
|
1
|
+
require_relative 'subscription_rejection/reject_subscription_channel_endpoint_test'
|
2
|
+
require_relative 'subscription_rejection/reject_subscription_channel_payload_combo_test'
|
3
|
+
require_relative 'subscription_rejection/reject_subscription_channel_type_test'
|
4
|
+
require_relative 'subscription_rejection/reject_subscription_cross_version_extension_test'
|
5
|
+
require_relative 'subscription_rejection/reject_subscription_filter_test'
|
6
|
+
require_relative 'subscription_rejection/reject_subscription_payload_type_test'
|
7
|
+
require_relative 'subscription_rejection/reject_subscription_topic_test'
|
2
8
|
|
3
9
|
module SubscriptionsTestKit
|
4
10
|
module SubscriptionsR5BackportR4Server
|
@@ -15,7 +21,13 @@ module SubscriptionsTestKit
|
|
15
21
|
:unsupported_subscription_channel_endpoint, :unsupported_subscription_payload_type,
|
16
22
|
:unsupported_subscription_channel_payload_combo
|
17
23
|
|
18
|
-
test from: :
|
24
|
+
test from: :subscriptions_r4_server_reject_subscription_cross_version_extension
|
25
|
+
test from: :subscriptions_r4_server_reject_subscription_topic
|
26
|
+
test from: :subscriptions_r4_server_reject_subscription_filter
|
27
|
+
test from: :subscriptions_r4_server_reject_subscription_channel_type
|
28
|
+
test from: :subscriptions_r4_server_reject_subscription_channel_endpoint
|
29
|
+
test from: :subscriptions_r4_server_reject_subscription_payload_type
|
30
|
+
test from: :subscriptions_r4_server_reject_subscription_channel_payload_combo
|
19
31
|
end
|
20
32
|
end
|
21
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: subscriptions_test_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl Naden, Emily Semple, Tom Strassner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inferno_core
|
@@ -88,7 +88,13 @@ files:
|
|
88
88
|
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/handshake_heartbeat_group.rb
|
89
89
|
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/status_operation/status_invocation_test.rb
|
90
90
|
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/status_operation_group.rb
|
91
|
-
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/
|
91
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_endpoint_test.rb
|
92
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_payload_combo_test.rb
|
93
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_type_test.rb
|
94
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_cross_version_extension_test.rb
|
95
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_filter_test.rb
|
96
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_payload_type_test.rb
|
97
|
+
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_topic_test.rb
|
92
98
|
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection_group.rb
|
93
99
|
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/workflow_group.rb
|
94
100
|
- lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server_suite.rb
|
@@ -1,185 +0,0 @@
|
|
1
|
-
require_relative '../common/subscription_creation'
|
2
|
-
|
3
|
-
module SubscriptionsTestKit
|
4
|
-
module SubscriptionsR5BackportR4Server
|
5
|
-
class RejectSubscriptionsTest < Inferno::Test
|
6
|
-
include SubscriptionCreation
|
7
|
-
|
8
|
-
id :subscriptions_r4_server_reject_subscriptions
|
9
|
-
title 'Server Handles Unsupported Subscriptions'
|
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. This test checks
|
14
|
-
that the server correctly rejects or adjusts the Subscription in the following cases:
|
15
|
-
|
16
|
-
- The Subscription contains cross-version extension
|
17
|
-
- The Subscription contains a Subscription Topic not implemented by the server
|
18
|
-
- The Subscription contains a filtering criteria not implemented by the server
|
19
|
-
- The Subscription contains channel type not implemented by the server
|
20
|
-
- The Subscription contains an unsupported channel endpoint
|
21
|
-
- The Subscription contains a payload type not implemented by the server
|
22
|
-
- The Subscription contains an unsupported channel and payload type combination
|
23
|
-
|
24
|
-
The test will pass if the server either
|
25
|
-
1. rejects the Subscription by responding with a non-201 response, or
|
26
|
-
2. updates the Subscription resource to remove or replace the unsupported value.
|
27
|
-
)
|
28
|
-
|
29
|
-
verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@8',
|
30
|
-
'hl7.fhir.uv.subscriptions_1.1.0@9',
|
31
|
-
'hl7.fhir.uv.subscriptions_1.1.0@10',
|
32
|
-
'hl7.fhir.uv.subscriptions_1.1.0@11',
|
33
|
-
'hl7.fhir.uv.subscriptions_1.1.0@12',
|
34
|
-
'hl7.fhir.uv.subscriptions_1.1.0@13'
|
35
|
-
|
36
|
-
input :subscription_resource,
|
37
|
-
title: 'Workflow Subscription Resource',
|
38
|
-
type: 'textarea',
|
39
|
-
description: %(
|
40
|
-
A Subscription resource in JSON format that Inferno will send to the server under test
|
41
|
-
so that it can demonstrate its ability to perform the Subscription creation and Notification
|
42
|
-
response workflow. The instance must be conformant to the R4/B Topic-Based Subscription profile.
|
43
|
-
Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
|
44
|
-
This input is also used by the unsupported Subscription test as the base on which to add unsupported
|
45
|
-
element values to test for server rejection.
|
46
|
-
)
|
47
|
-
input :unsupported_subscription_topic,
|
48
|
-
title: 'Unsupported Subscription Topic',
|
49
|
-
description: %(A Subscription Topic for the `criteria` element that is not implemented by the server to test
|
50
|
-
for Subscription rejection.),
|
51
|
-
optional: true
|
52
|
-
input :unsupported_subscription_filter,
|
53
|
-
title: 'Unsupported Subscription Filter',
|
54
|
-
description: %(A value for `filterCriteria` extension under the `criteria` that is not implemented by the
|
55
|
-
server to test for Subscription rejection.),
|
56
|
-
optional: true
|
57
|
-
input :unsupported_subscription_channel_type,
|
58
|
-
title: 'Unsupported Subscription Channel Type',
|
59
|
-
description: %(A value for the `channel.type` element that is not implemented by the server to test for
|
60
|
-
Subscription rejection.),
|
61
|
-
optional: true
|
62
|
-
input :unsupported_subscription_channel_endpoint,
|
63
|
-
title: 'Unsupported Subscription Channel Endpoint',
|
64
|
-
description: 'An unsupported value for the `channel.endpoint` element to test for Subscription rejection.',
|
65
|
-
optional: true
|
66
|
-
input :unsupported_subscription_payload_type,
|
67
|
-
title: 'Unsupported Subscription Payload Type',
|
68
|
-
description: %(A value for the `content` extension under the `channel.payload` element that is not
|
69
|
-
implemented by the server to test for Subscription rejection.),
|
70
|
-
optional: true
|
71
|
-
input :unsupported_subscription_channel_payload_combo,
|
72
|
-
title: 'Unsupported Subscription Channel and Payload Combination',
|
73
|
-
description: %(
|
74
|
-
A channel (`channel.type`) and payload type (`content` extension under the `channel.payload` element)
|
75
|
-
combination not implemented by the server to test for Subscription
|
76
|
-
rejection. Provide in the json format e.g. {channel: <'channel_type'>, payload: <'payload_type'>}.
|
77
|
-
),
|
78
|
-
optional: true
|
79
|
-
|
80
|
-
def unsupported_subscriptions
|
81
|
-
[
|
82
|
-
{
|
83
|
-
'unsupported_title' => 'cross-version extensions',
|
84
|
-
'field_path' => ['_criteria'],
|
85
|
-
'field_value' => { 'extension' => [{
|
86
|
-
url: 'http://hl7.org/fhir/5.0/subscriptions-backport/StructureDefinition/backport-filter-criteria',
|
87
|
-
valueString: 'Encounter?patient=Patient/123'
|
88
|
-
}] }
|
89
|
-
},
|
90
|
-
{
|
91
|
-
'unsupported_title' => 'unsupported `SubscriptionTopic`',
|
92
|
-
'field_path' => ['criteria'],
|
93
|
-
'field_value' => unsupported_subscription_topic
|
94
|
-
},
|
95
|
-
{
|
96
|
-
'unsupported_title' => 'unsupported filter criteria',
|
97
|
-
'field_path' => ['_criteria'],
|
98
|
-
'field_value' => if unsupported_subscription_filter.nil?
|
99
|
-
unsupported_subscription_filter
|
100
|
-
else
|
101
|
-
{ 'extension' => [{
|
102
|
-
url: 'http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-filter-criteria',
|
103
|
-
valueString: unsupported_subscription_filter
|
104
|
-
}] }
|
105
|
-
end
|
106
|
-
},
|
107
|
-
{
|
108
|
-
'unsupported_title' => 'unsupported channel type',
|
109
|
-
'field_path' => ['channel', 'type'],
|
110
|
-
'field_value' => unsupported_subscription_channel_type
|
111
|
-
},
|
112
|
-
{
|
113
|
-
'unsupported_title' => 'unsupported channel URL',
|
114
|
-
'field_path' => ['channel', 'endpoint'],
|
115
|
-
'field_value' => unsupported_subscription_channel_endpoint
|
116
|
-
},
|
117
|
-
{
|
118
|
-
'unsupported_title' => 'unsupported channel type',
|
119
|
-
'field_path' => ['channel', 'type'],
|
120
|
-
'field_value' => unsupported_subscription_channel_type
|
121
|
-
},
|
122
|
-
{
|
123
|
-
'unsupported_title' => 'unsupported payload type',
|
124
|
-
'field_path' => ['channel', 'payload'],
|
125
|
-
'field_value' => unsupported_subscription_payload_type
|
126
|
-
}
|
127
|
-
]
|
128
|
-
end
|
129
|
-
|
130
|
-
run do
|
131
|
-
assert_valid_json(subscription_resource)
|
132
|
-
subscription = JSON.parse(subscription_resource)
|
133
|
-
|
134
|
-
unsupported_subscriptions.each do |unsupported_info|
|
135
|
-
next if unsupported_info['field_value'].blank?
|
136
|
-
|
137
|
-
field_name = unsupported_info['field_path'].last
|
138
|
-
|
139
|
-
if unsupported_info['field_path'].length > 1
|
140
|
-
outer_field_name = unsupported_info['field_path'].first
|
141
|
-
subscription_field = subscription[outer_field_name]
|
142
|
-
else
|
143
|
-
subscription_field = subscription
|
144
|
-
end
|
145
|
-
|
146
|
-
original_field_value = subscription_field[field_name]
|
147
|
-
subscription_field[field_name] = unsupported_info['field_value']
|
148
|
-
|
149
|
-
send_unsupported_subscription(subscription, unsupported_info['unsupported_title'],
|
150
|
-
[unsupported_info['field_path']], [unsupported_info['field_value']])
|
151
|
-
|
152
|
-
if original_field_value.nil?
|
153
|
-
subscription_field.delete(field_name)
|
154
|
-
else
|
155
|
-
subscription_field[field_name] = original_field_value
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
if unsupported_subscription_channel_payload_combo.present?
|
160
|
-
assert_valid_json(unsupported_subscription_channel_payload_combo)
|
161
|
-
channel_payload_combo = JSON.parse(unsupported_subscription_channel_payload_combo)
|
162
|
-
channel_value = channel_payload_combo['channel']
|
163
|
-
payload_value = channel_payload_combo['payload']
|
164
|
-
|
165
|
-
if channel_value.blank? || payload_value.blank?
|
166
|
-
add_message('error', %(Channel and payload values are not populated correctly in unsupported channel and
|
167
|
-
payload combination input.))
|
168
|
-
else
|
169
|
-
subscription_channel = subscription['channel']
|
170
|
-
subscription_channel['type'] = channel_value
|
171
|
-
subscription_channel['payload'] = payload_value
|
172
|
-
|
173
|
-
channel_path = ['channel', 'type']
|
174
|
-
payload_path = ['channel', 'payload']
|
175
|
-
|
176
|
-
send_unsupported_subscription(subscription, 'unsupported channel and payload combination',
|
177
|
-
[channel_path, payload_path], [channel_value, payload_value])
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
181
|
-
no_error_verification('Unsupported Subscription creation error handling failures.')
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
end
|