subscriptions_test_kit 0.9.2 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/inferno_requirements_tools/tasks/collect_requirements.rb +51 -50
  3. data/lib/inferno_requirements_tools/tasks/requirements_coverage.rb +22 -19
  4. data/lib/subscriptions_test_kit/common/notification_conformance_verification.rb +11 -12
  5. data/lib/subscriptions_test_kit/common/subscription_conformance_verification.rb +14 -2
  6. data/lib/subscriptions_test_kit/docs/samples/Subscription_empty.json +1 -1
  7. data/lib/subscriptions_test_kit/docs/samples/Subscription_full-resource.json +1 -1
  8. data/lib/subscriptions_test_kit/docs/samples/Subscription_id-only.json +1 -1
  9. data/lib/subscriptions_test_kit/docs/subscriptions_r5_backport_r4_client_suite_description.md +4 -1
  10. data/lib/subscriptions_test_kit/docs/subscriptions_r5_backport_r4_server_suite_description.md +4 -1
  11. data/lib/subscriptions_test_kit/endpoints/subscription_create_endpoint.rb +7 -3
  12. data/lib/subscriptions_test_kit/endpoints/subscription_status_endpoint.rb +19 -13
  13. data/lib/subscriptions_test_kit/jobs/send_subscription_notifications.rb +7 -2
  14. data/lib/subscriptions_test_kit/requirements/generated/subscriptions-test-kit_requirements_coverage.csv +51 -51
  15. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/common/subscription_simulation_utils.rb +47 -16
  16. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/notification_input_payload_verification_test.rb +15 -8
  17. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/notification_input_verification_test.rb +8 -5
  18. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/processing_attestation_test.rb +1 -1
  19. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification/subscription_verification_test.rb +3 -2
  20. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/conformance_verification_group.rb +1 -1
  21. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/interaction_test.rb +15 -11
  22. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/interaction_verification/event_notification_verification_test.rb +6 -5
  23. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/interaction_verification/handshake_notification_verification_test.rb +5 -5
  24. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client/workflow/interaction_verification_group.rb +1 -1
  25. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_client_suite.rb +5 -3
  26. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/capability_statement/cs_conformance_test.rb +1 -1
  27. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/capability_statement/topic_discovery_test.rb +3 -3
  28. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/capability_statement_group.rb +3 -3
  29. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction/creation_response_conformance_test.rb +1 -1
  30. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction/subscription_conformance_test.rb +11 -14
  31. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/interaction_group.rb +3 -3
  32. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/subscription_creation.rb +10 -1
  33. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/common/subscription_status_operation.rb +3 -2
  34. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/empty_content_group.rb +3 -2
  35. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/full_resource_content/full_resource_conformance_test.rb +3 -4
  36. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/full_resource_content_group.rb +3 -2
  37. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/id_only_content/id_only_conformance_test.rb +3 -4
  38. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification/id_only_content_group.rb +3 -2
  39. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/event_notification_group.rb +2 -2
  40. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/handshake_heartbeat/handshake_conformance_test.rb +7 -6
  41. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/handshake_heartbeat/heartbeat_conformance_test.rb +4 -2
  42. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/status_operation/status_invocation_test.rb +2 -2
  43. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/status_operation_group.rb +1 -1
  44. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_endpoint_test.rb +65 -0
  45. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_payload_combo_test.rb +76 -0
  46. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_channel_type_test.rb +68 -0
  47. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_cross_version_extension_test.rb +59 -0
  48. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_filter_test.rb +66 -0
  49. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_payload_type_test.rb +66 -0
  50. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscription_topic_test.rb +64 -0
  51. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection_group.rb +14 -2
  52. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server_suite.rb +3 -2
  53. data/lib/subscriptions_test_kit/version.rb +1 -3
  54. metadata +11 -75
  55. data/lib/subscriptions_test_kit/suites/subscriptions_r5_backport_r4_server/subscription_rejection/reject_subscriptions_test.rb +0 -181
@@ -13,8 +13,11 @@ module SubscriptionsTestKit
13
13
 
14
14
  id :subscriptions_r4_client_notification_input_payload_verification
15
15
  title '[USER INPUT VERIFICATION] Notification Bundle Input Conformance Verification for Payload Content'
16
- description 'This test verifies that the notification bundle from the test input meets the requirements '\
17
- 'of the payload indicated in the subscription created by the client under test.'
16
+ description %(
17
+ This test verifies that the notification bundle sent by Inferno meets the requirements
18
+ of the payload indicated in the subscription created by the client under test.
19
+ The content of the notification will be based on the Bundle provided by the tester.
20
+ )
18
21
  input :notification_bundle
19
22
 
20
23
  run do
@@ -30,21 +33,25 @@ module SubscriptionsTestKit
30
33
  payload_content_code = payload_ext['valueCode'] if payload_ext
31
34
  skip_if(payload_content_code.nil?, 'Subscription does not have a payload content code')
32
35
 
33
- criteria_resource_type = subscription_criteria(subscription.source_hash)
36
+ load_tagged_requests(REST_HOOK_EVENT_NOTIFICATION_TAG)
37
+ skip_if(requests.none?, 'Inferno did not send an event notification')
34
38
 
35
39
  case payload_content_code
36
40
  when 'empty'
37
- empty_event_notification_verification(notification_bundle)
41
+ empty_event_notification_verification(request.request_body)
38
42
  when 'id-only'
39
- id_only_event_notification_verification(notification_bundle, criteria_resource_type)
43
+ id_only_event_notification_verification(request.request_body, nil)
40
44
  when 'full-resource'
41
- full_resource_event_notification_verification(notification_bundle, criteria_resource_type)
45
+ full_resource_event_notification_verification(request.request_body, nil)
42
46
  else
43
47
  skip "Unrecognized payload content code: #{payload_content_code}"
44
48
  end
45
49
 
46
- no_error_verification('Notification bundle input payload content was not conformant, see error messages')
50
+ no_error_verification(%(
51
+ Notification bundle payload content was not conformant to requirements of the #{payload_content_code}
52
+ content type. See error messages for details.
53
+ ))
47
54
  end
48
55
  end
49
56
  end
50
- end
57
+ end
@@ -10,16 +10,19 @@ module SubscriptionsTestKit
10
10
  id :subscriptions_r4_client_notification_input_verification
11
11
  title '[USER INPUT VERIFICATION] Notification Bundle Input Conformance Verification'
12
12
  description %(
13
- This test verifies that the notification bundle provided by the tester is conformant
13
+ This test verifies that the notification bundle sent is conformant
14
14
  to the [R4 Topic-Based Subscription Notification Bundle
15
15
  profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html).
16
- )
16
+ The content of the notification will be based on the Bundle provided by the tester.
17
+ )
17
18
  input :notification_bundle
18
19
 
19
20
  run do
20
- notification_verification(notification_bundle, 'event-notification')
21
- no_error_verification('Notification bundle input was not conformant, see error messages')
21
+ load_tagged_requests(REST_HOOK_EVENT_NOTIFICATION_TAG)
22
+ skip_if(requests.none?, 'Inferno did not send an event notification')
23
+ notification_verification(request.request_body, 'event-notification')
24
+ no_error_verification('Notification bundle was not conformant, see error messages')
22
25
  end
23
26
  end
24
27
  end
25
- end
28
+ end
@@ -10,7 +10,7 @@ module SubscriptionsTestKit
10
10
  title 'Client Subscription Conformance Verification'
11
11
  description %(
12
12
  This test verifies that the Subscription created by the client under test
13
- is conformant to the [R4/B Topic-Based Subscription
13
+ is conformant to the [R4/B Topic-Based Subscription
14
14
  profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription.html)
15
15
  and meets other requirements placed on it by the IG.
16
16
  )
@@ -22,7 +22,8 @@ module SubscriptionsTestKit
22
22
  load_tagged_requests(SUBSCRIPTION_CREATE_TAG)
23
23
  skip_if(requests.none?, 'Inferno did not receive a Subscription creation request')
24
24
  subscription_verification(request.request_body)
25
+ no_error_verification('Subscription resource is not conformant.')
25
26
  end
26
27
  end
27
28
  end
28
- end
29
+ end
@@ -17,4 +17,4 @@ module SubscriptionsTestKit
17
17
  test from: :subscriptions_r4_client_processing_attestation
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -3,6 +3,7 @@
3
3
  module SubscriptionsTestKit
4
4
  module SubscriptionsR5BackportR4Client
5
5
  class InteractionTest < Inferno::Test
6
+ include URLs
6
7
  id :subscriptions_r4_client_interaction
7
8
  description %(
8
9
  During this test, the client under test will interact with Inferno following the Subscription
@@ -17,19 +18,20 @@ module SubscriptionsTestKit
17
18
  Afterwards, Inferno will no longer respond to requests.
18
19
 
19
20
  To create the handshake and event notifications, Inferno uses the contents of the *Event
20
- Notification Bundle* input. The provided notification will be modified as appropriate for
21
+ Notification Bundle* input. The provided notification will be modified as appropriate for
21
22
  the request Inferno is making:
22
23
  - General changes for all notification types
23
24
  - update the `subscription` parameter entry reference.
24
25
  - update the `status` parameter entry based on the previous interactions.
25
- - update the `type` parameter entry based on the notification type (e.g., `event-notification` or `handshake`).
26
+ - update the `type` parameter entry based on the notification type (e.g., `event-notification` or
27
+ `handshake`).
26
28
  - update the number of notifications sent in the `events-since-subscription-start` parameter entry.
27
29
  - `handshake`-specific changes:
28
30
  - clear the `events` parameter entry.
29
31
  - clear the `errors` parameter entry.
30
32
 
31
- While the provided Notification must be conformant to the
32
- [R4 Topic-Based Subscription Notification Bundle
33
+ While the provided Notification must be conformant to the
34
+ [R4 Topic-Based Subscription Notification Bundle
33
35
  profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html)
34
36
  for the tests to pass, the tests can run as long as the notification meets the
35
37
  following minimal requirements:
@@ -49,10 +51,10 @@ module SubscriptionsTestKit
49
51
  optional: true,
50
52
  title: 'Client Notification Access Token',
51
53
  description: %(
52
- The bearer token that Inferno will send on requests to the client under test's rest-hook notification endpoint. Not
53
- needed if the client under test will create a Subscription with an appropriate header value in the
54
- `channel.header` element. If a value for the `authorization` header is provided in `channel.header`, this
55
- value will override it.
54
+ The bearer token that Inferno will send on requests to the client under test's rest-hook notification
55
+ endpoint. Not needed if the client under test will create a Subscription with an appropriate header value
56
+ in the `channel.header` element. If a value for the `authorization` header is provided in
57
+ `channel.header`, this value will override it.
56
58
  )
57
59
  input :notification_bundle,
58
60
  title: 'Event Notification Bundle',
@@ -67,7 +69,9 @@ module SubscriptionsTestKit
67
69
 
68
70
  run do
69
71
  minimally_validate_notification(notification_bundle)
70
- assert(messages.none? { |m| m[:type] == 'error' }, 'Notification Bundle input is invalid for use by Inferno, see error message(s)')
72
+ assert(messages.none? do |m|
73
+ m[:type] == 'error'
74
+ end, 'Notification Bundle input is invalid for use by Inferno, see error message(s)')
71
75
 
72
76
  wait(
73
77
  identifier: access_token,
@@ -118,11 +122,11 @@ module SubscriptionsTestKit
118
122
  # Require the subscription param, just because we need something to later identify the subscription status
119
123
  # bundle entry. Note we could just as easily use a different required param, like status or type.
120
124
  subscription_param = subscription_status.parameter&.find { |p| p.name == 'subscription' }
121
- assert(subscription_param.present?, 'Subscription status entry in notification bundle input must contain a'\
125
+ assert(subscription_param.present?, 'Subscription status entry in notification bundle input must contain a' \
122
126
  'subscription parameter')
123
127
  rescue Inferno::Exceptions::AssertionException => e
124
128
  add_message('error', e.message)
125
129
  end
126
130
  end
127
131
  end
128
- end
132
+ end
@@ -23,18 +23,19 @@ module SubscriptionsTestKit
23
23
  # The SendSubscriptionNotifications job saves a nil status if the request fails entirely
24
24
  assert(request.status.present?, "Handshake notification request failed with error: #{request.response_body}")
25
25
 
26
- assert(request.status.between?(200, 299), "Event notification was not successful, status code #{request.status}")
26
+ assert(request.status.between?(200, 299),
27
+ "Event notification was not successful, status code #{request.status}")
27
28
 
28
29
  subscription = find_subscription(test_session_id)
29
30
  if subscription.present?
30
31
  mime_type = subscription&.channel&.payload
31
32
  unless ALLOWED_MIME_TYPES.include?(mime_type)
32
- add_message('warning', %(Subscription specified '#{mime_type}' for `Subscription.channel.payload`, but Inferno
33
- only supports: #{ALLOWED_MIME_TYPES.map { |type| "'#{type}'" }.join(', ')}.
34
- Event notification was sent with Content-Type: '#{DEFAULT_MIME_TYPE}'.))
33
+ add_message('warning', %(Subscription specified '#{mime_type}' for `Subscription.channel.payload`, but
34
+ Inferno only supports: #{ALLOWED_MIME_TYPES.map { |type| "'#{type}'" }.join(', ')}.
35
+ Event notification was sent with Content-Type: '#{DEFAULT_MIME_TYPE}'.))
35
36
  end
36
37
  end
37
38
  end
38
39
  end
39
40
  end
40
- end
41
+ end
@@ -23,18 +23,18 @@ module SubscriptionsTestKit
23
23
  assert(request.status.present?, "Handshake notification request failed with error: #{request.response_body}")
24
24
 
25
25
  assert(request.status.between?(200, 299),
26
- "Handshake notification was not successful, status code #{request.status}")
26
+ "Handshake notification was not successful, status code #{request.status}")
27
27
 
28
28
  subscription = find_subscription(test_session_id)
29
29
  if subscription.present?
30
30
  mime_type = subscription&.channel&.payload
31
31
  unless ALLOWED_MIME_TYPES.include?(mime_type)
32
- add_message('warning', %(Subscription specified '#{mime_type}' for `Subscription.channel.payload`, but Inferno
33
- only supports: #{ALLOWED_MIME_TYPES.map { |type| "'#{type}'" }.join(', ')}.
34
- Handshake notification was sent with Content-Type: '#{DEFAULT_MIME_TYPE}'.))
32
+ add_message('warning', %(Subscription specified '#{mime_type}' for `Subscription.channel.payload`, but
33
+ Inferno only supports: #{ALLOWED_MIME_TYPES.map { |type| "'#{type}'" }.join(', ')}.
34
+ Handshake notification was sent with Content-Type: '#{DEFAULT_MIME_TYPE}'.))
35
35
  end
36
36
  end
37
37
  end
38
38
  end
39
39
  end
40
- end
40
+ end
@@ -13,4 +13,4 @@ module SubscriptionsTestKit
13
13
  test from: :subscriptions_r4_client_event_notification_verification
14
14
  end
15
15
  end
16
- end
16
+ end
@@ -13,7 +13,8 @@ module SubscriptionsTestKit
13
13
  title 'Subscriptions R5 Backport IG v1.1.0 FHIR R4 Client Test Suite'
14
14
  short_title 'Subscriptions R4 Client'
15
15
  version VERSION
16
- description File.read(File.join(__dir__, '..', 'docs', 'subscriptions_r5_backport_r4_client_suite_description.md'))
16
+ description File.read(File.join(__dir__, '..', 'docs',
17
+ 'subscriptions_r5_backport_r4_client_suite_description.md'))
17
18
 
18
19
  links [
19
20
  {
@@ -43,7 +44,8 @@ module SubscriptionsTestKit
43
44
  end
44
45
  end
45
46
 
46
- capability_statement = File.read(File.join(__dir__, 'subscriptions_r5_backport_r4_client', 'fixtures', 'capability_statement.json'))
47
+ capability_statement = File.read(File.join(__dir__, 'subscriptions_r5_backport_r4_client', 'fixtures',
48
+ 'capability_statement.json'))
47
49
  route(:get, '/fhir/metadata', proc { [200, { 'Content-Type' => 'application/json' }, [capability_statement]] })
48
50
 
49
51
  suite_endpoint :post, FHIR_SUBSCRIPTION_PATH, SubscriptionCreateEndpoint
@@ -63,4 +65,4 @@ module SubscriptionsTestKit
63
65
  group from: :subscriptions_r4_client_workflow
64
66
  end
65
67
  end
66
- end
68
+ end
@@ -33,7 +33,7 @@ module SubscriptionsTestKit
33
33
  assert(rest_subscription.present?, 'Capability Statement missing `Subscription` resource in `rest` field')
34
34
 
35
35
  assert(rest_subscription.supportedProfile.present?,
36
- 'Capability Statement missing the `supportedProfile` field in `Subscription` resource')
36
+ 'Capability Statement missing the `supportedProfile` field in `Subscription` resource')
37
37
 
38
38
  subscription_profile_present = rest_subscription.supportedProfile.any? do |profile|
39
39
  profile == subscription_profile_url
@@ -59,7 +59,7 @@ module SubscriptionsTestKit
59
59
  assert(rest_subscription.present?, 'Capability Statement missing `Subscription` resource in `rest` field')
60
60
 
61
61
  assert(rest_subscription.extension.present?,
62
- 'Capability Statement missing the `extension` field on the Subscription resource')
62
+ 'Capability Statement missing the `extension` field on the Subscription resource')
63
63
  subscription_topic_extension = rest_subscription.extension.select do |elem|
64
64
  elem.url == capability_statement_subscriptiontopic_extension
65
65
  end
@@ -97,8 +97,8 @@ module SubscriptionsTestKit
97
97
  )
98
98
  else
99
99
  add_message('warning', %(
100
- No Subscription requests have been made in previous tests. Run the Subscription workflow tests first in order
101
- to verify topics found in the SubscriptionTopic Canonical extension))
100
+ No Subscription requests have been made in previous tests. Run the Subscription workflow tests first in
101
+ order to verify topics found in the SubscriptionTopic Canonical extension))
102
102
  end
103
103
  end
104
104
  end
@@ -7,9 +7,9 @@ module SubscriptionsTestKit
7
7
  id :subscriptions_r4_server_capability_statement
8
8
  title 'Capability Statement Verification'
9
9
  description %(
10
- Verify the Backport Subscriptions Server has a conformant Capability Statement and that it declares support for the
11
- Backport Subscription Profile on the Subscription resource in the rest field. Then the group will verify if the
12
- server supports topic discovert via the Capability Statement, which is an optional requirement.
10
+ Verify the Backport Subscriptions Server has a conformant Capability Statement and that it declares support for
11
+ the Backport Subscription Profile on the Subscription resource in the rest field. Then the group will verify if
12
+ the server supports topic discovert via the Capability Statement, which is an optional requirement.
13
13
  )
14
14
 
15
15
  run_as_group
@@ -43,7 +43,7 @@ module SubscriptionsTestKit
43
43
  assert_resource_type('Subscription', resource: subscription)
44
44
 
45
45
  assert(subscription.channel.type == 'rest-hook' && subscription.status == 'requested',
46
- "The Subscription resource should have it's status set to 'requested', was '#{subscription.status}'")
46
+ "The Subscription resource should have it's status set to 'requested', was '#{subscription.status}'")
47
47
  end
48
48
  end
49
49
  end
@@ -11,26 +11,28 @@ module SubscriptionsTestKit
11
11
  The Subscription resource is used to request notifications for a specific client about a specific topic
12
12
  Conceptually, a subscription is a concrete request for a single client to receive notifications per a single
13
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 can
15
- be found on the [Subscriptions R5 Backport IG's Artifacts page](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/artifacts.html#5).
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).
16
17
 
17
- This test accepts a Subscription resource as an input and verifies that it is conformant to the
18
+ This test accepts a Subscription resource as an input and verifies that it is conformant to the
18
19
  [R4/B Topic-Based Subscription profile](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription.html).
19
20
 
20
21
  The Subscription channel should have it's fields populated with the following information:
21
22
  - The `endpoint` field must be set to
22
- `#{Inferno::Application['base_url']}/custom/subscriptions_r5_backport_r4_server/subscription/channel/notification_listener`.
23
+ `#{Inferno::Application['base_url']}/custom/subscriptions_r5_backport_r4_server#{SUBSCRIPTION_CHANNEL_PATH}`.
23
24
  The test will add the correct url to this field if it is not properly set.
24
25
  - The `type` field must be set to `rest-hook`, as the Inferno subscription workflow tests use a `rest-hook`
25
26
  subscription channel to receive incoming notifications. The test will add the correct type to this field if it
26
27
  is not properly set.
27
- - The `payload` field must be set to `application/json`, as Inferno will only accept resources in requests with
28
- this content type.
28
+ - The `payload` field must be set to `application/json`, as Inferno will only accept resources in requests
29
+ with this content type.
29
30
  - The `header` field must include the `Authorization` header with a Bearer token set to the inputted Inferno
30
31
  access token.
31
32
  )
32
33
 
33
34
  verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@72',
35
+ 'hl7.fhir.uv.subscriptions_1.1.0@73',
34
36
  'hl7.fhir.uv.subscriptions_1.1.0@86'
35
37
 
36
38
  input :subscription_resource,
@@ -41,8 +43,8 @@ module SubscriptionsTestKit
41
43
  so that it can demonstrate its ability to perform the Subscription creation and Notification
42
44
  response workflow. The instance must be conformant to the R4/B Topic-Based Subscription profile.
43
45
  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 element
45
- values to test for server rejection.
46
+ This input is also used by the unsupported Subscription test as the base on which to add unsupported
47
+ element values to test for server rejection.
46
48
  )
47
49
  input :access_token,
48
50
  title: 'Notification Access Token',
@@ -53,17 +55,12 @@ module SubscriptionsTestKit
53
55
  sent to Inferno.
54
56
  )
55
57
 
56
- output :updated_subscription, :subscription_topic
58
+ output :updated_subscription
57
59
 
58
60
  run do
59
61
  omit_if subscription_resource.blank?, 'Did not input a Subscription resource of this type.'
60
62
  subscription = subscription_verification(subscription_resource)
61
63
  no_error_verification('Subscription resource is not conformant.')
62
-
63
- assert(subscription['criteria'].present?,
64
- 'The `criteria` field SHALL be populated and contain the canonical URL for the Subscription Topic.')
65
- output subscription_topic: subscription['criteria']
66
-
67
64
  subscription = server_check_channel(subscription, access_token)
68
65
  output updated_subscription: subscription.to_json
69
66
  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 a notification
13
- for that Subscription. Inferno will act as a client, creating the Subscription and waiting for a notification
14
- based on it.
12
+ server under test to accept a request for the creation of a FHIR Subscription instance and deliver a
13
+ notification for that Subscription. Inferno will act as a client, creating the Subscription and waiting for a
14
+ notification based on it.
15
15
  )
16
16
 
17
17
  run_as_group
@@ -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
- if subscription_field_new_value != subscription_field_old_values[index]
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
@@ -17,7 +17,8 @@ module SubscriptionsTestKit
17
17
  assert_resource_type('Bundle')
18
18
 
19
19
  unless resource.type == 'searchset'
20
- add_message('error', "Bundle returned from $status operation should be type 'searchset', was #{resource.type}")
20
+ add_message('error',
21
+ "Bundle returned from $status operation should be type 'searchset', was #{resource.type}")
21
22
  end
22
23
 
23
24
  assert_valid_resource
@@ -39,7 +40,7 @@ module SubscriptionsTestKit
39
40
  entry.resource.resourceType == 'Parameters' && subscription_ref_found?(entry, subscription_id)
40
41
  end
41
42
  assert(subscription_status_entry,
42
- "No Subscription status with id #{subscription_id} returned from $status operation")
43
+ "No Subscription status with id #{subscription_id} returned from $status operation")
43
44
 
44
45
  subscription_status_resource = subscription_status_entry.resource
45
46
  assert_valid_resource(resource: subscription_status_resource,
@@ -31,9 +31,10 @@ module SubscriptionsTestKit
31
31
  type: 'textarea',
32
32
  description: %(
33
33
  A Subscription resource in JSON format that Inferno will send to the server under test
34
- so that it can demonstrate its ability to send an empty Notification.
34
+ so that it can demonstrate its ability to send an empty Notification.
35
35
  The instance must be conformant to the R4/B Topic-Based Subscription profile.
36
- Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
36
+ Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification
37
+ endpoint.
37
38
  ),
38
39
  optional: true
39
40
  },
@@ -12,8 +12,8 @@ module SubscriptionsTestKit
12
12
  [R4 Topic-Based Subscription Notification Bundle](https://hl7.org/fhir/uv/subscriptions-backport/STU1.1/StructureDefinition-backport-subscription-notification-r4.html)
13
13
  profle.
14
14
 
15
- With the content type of full-resource, the resources involved in triggering the notification are included in the
16
- notification bundle.
15
+ With the content type of full-resource, the resources involved in triggering the notification are included in
16
+ the notification bundle.
17
17
 
18
18
  When the content type is full-resource, notification bundles SHALL include references to the
19
19
  appropriate focus resources in the SubscriptionStatus.notificationEvent.focus element.
@@ -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, criteria_resource_type)
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.')
@@ -31,9 +31,10 @@ module SubscriptionsTestKit
31
31
  type: 'textarea',
32
32
  description: %(
33
33
  A Subscription resource in JSON format that Inferno will send to the server under test
34
- so that it can demonstrate its ability to send a full-resource Notification.
34
+ so that it can demonstrate its ability to send a full-resource Notification.
35
35
  The instance must be conformant to the R4/B Topic-Based Subscription profile.
36
- Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
36
+ Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification
37
+ endpoint.
37
38
  ),
38
39
  optional: true
39
40
  },
@@ -15,8 +15,8 @@ module SubscriptionsTestKit
15
15
  With the content type of id-only, the resources involved in triggering the notification are only available
16
16
  through other channels, but notifications include URLs which can be used to access those resources.
17
17
 
18
- When the content type is id-only, notification bundles SHALL include references to the appropriate focus resources
19
- in the SubscriptionStatus.notificationEvent.focus element.
18
+ When the content type is id-only, notification bundles SHALL include references to the appropriate focus
19
+ resources in the SubscriptionStatus.notificationEvent.focus element.
20
20
 
21
21
  Additionally, notification bundles MAY contain, in addition to the SubscriptionStatus used to convey status
22
22
  information, at least one Bundle.entry for each resource relevant to the notification.
@@ -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, criteria_resource_type)
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.')
@@ -31,9 +31,10 @@ module SubscriptionsTestKit
31
31
  type: 'textarea',
32
32
  description: %(
33
33
  A Subscription resource in JSON format that Inferno will send to the server under test
34
- so that it can demonstrate its ability to send an id-only Notification.
34
+ so that it can demonstrate its ability to send an id-only Notification.
35
35
  The instance must be conformant to the R4/B Topic-Based Subscription profile.
36
- Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification endpoint.
36
+ Inferno may modify the Subscription before submission, e.g., to point to Inferno's notification
37
+ endpoint.
37
38
  ),
38
39
  optional: true
39
40
  },
@@ -10,8 +10,8 @@ module SubscriptionsTestKit
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 content type. This group contains tests for the three options
14
- available when specifying the contents of a Notification: empty, id-only, and full-resource.
13
+ profile, including additional requirements around the content type. This group contains tests for the three
14
+ options available when specifying the contents of a Notification: empty, id-only, and full-resource.
15
15
  )
16
16
 
17
17
  input_order :url, :credentials, :access_token, :empty_subscription_resource,
@@ -9,9 +9,9 @@ module SubscriptionsTestKit
9
9
  title 'Subscription Handshake Verification'
10
10
  description %(
11
11
  When a Subscription is created for a REST Hook channel type, the server SHALL set initial status to requested,
12
- pending verification of the nominated endpoint URL. The Server will then send a handshake bundle to the endpoint.
13
- After a successful handshake notification has been sent and accepted, the server SHALL update the status to
14
- active. This test verifies that the incoming handshake request is a conformant
12
+ pending verification of the nominated endpoint URL. The Server will then send a handshake bundle to the
13
+ endpoint. After a successful handshake notification has been sent and accepted, the server SHALL update the
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
16
  )
17
17
 
@@ -41,9 +41,10 @@ module SubscriptionsTestKit
41
41
 
42
42
  requests = load_tagged_requests('handshake')
43
43
  if requests.empty?
44
- omit_if subscription_request_ids.empty?, 'No handshake requests were required or received in a previous tests.'
44
+ omit_if subscription_request_ids.empty?,
45
+ 'No handshake requests were required or received in a previous tests.'
45
46
  assert(subscription_request_ids.empty?,
46
- 'Handshake requests are required if a Subscription channel type is `rest-hook`')
47
+ 'Handshake requests are required if a Subscription channel type is `rest-hook`')
47
48
  end
48
49
 
49
50
  requests = requests.uniq(&:request_body)
@@ -60,7 +61,7 @@ module SubscriptionsTestKit
60
61
 
61
62
  no_error_verification('Received handshakes are not conformant.')
62
63
  assert(subscription_request_ids.empty?,
63
- 'Did not receive a handshake notification for some `rest-hook` subscriptions')
64
+ 'Did not receive a handshake notification for some `rest-hook` subscriptions')
64
65
  end
65
66
  end
66
67
  end
@@ -26,7 +26,9 @@ module SubscriptionsTestKit
26
26
  def heartbeat_period?(subscription_extensions)
27
27
  return false if subscription_extensions.blank?
28
28
 
29
- heartbeat = subscription_extensions.find { |extension| extension['url'].ends_with?('/backport-heartbeat-period') }
29
+ heartbeat = subscription_extensions.find do |extension|
30
+ extension['url'].ends_with?('/backport-heartbeat-period')
31
+ end
30
32
 
31
33
  return false if heartbeat.blank?
32
34
 
@@ -63,7 +65,7 @@ module SubscriptionsTestKit
63
65
  subscription_id = tags.first
64
66
 
65
67
  assert(subscription_request_ids.include?(subscription_id),
66
- 'If `heartbeatPeriod` field is not present in the Subscription, heartbeat should not be sent.')
68
+ 'If `heartbeatPeriod` field is not present in the Subscription, heartbeat should not be sent.')
67
69
 
68
70
  notification_verification(request.request_body, 'heartbeat', subscription_id:)
69
71
  no_error_verification('Received heartbeats are not conformant.')
@@ -14,8 +14,8 @@ module SubscriptionsTestKit
14
14
  resources, one per Subscription being queried. The Bundle type is "searchset". The status of the Subscription
15
15
  should be set to 'active' after a successful handshake with the rest-hook endpoint.
16
16
 
17
- This test ensures the server supports the $status operation by performing the operation and ensuring it receives a
18
- valid response.
17
+ This test ensures the server supports the $status operation by performing the operation and ensuring it receives
18
+ a valid response.
19
19
  )
20
20
 
21
21
  verifies_requirements 'hl7.fhir.uv.subscriptions_1.1.0@20',