Scalable Consent Management Testing Guide
1.0.0-ballot - ci-build United States of America flag

Scalable Consent Management Testing Guide - Local Development build (v1.0.0-ballot) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

: 04 Basic REST-hook Subs - All SUT | 02 Create subscription then handshake - XML Representation

Page standards status: Trial-use Maturity Level: 1

Raw xml | Download


<TestScript xmlns="http://hl7.org/fhir">
  <id value="02-Create-subscription-then-handshake"/>
  <meta>
    <profile
             value="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript"/>
  </meta>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: TestScript 02-Create-subscription-then-handshake</b></p><a name="02-Create-subscription-then-handshake"> </a><a name="hc02-Create-subscription-then-handshake"> </a><div style="display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%"><p style="margin-bottom: 0px"/><p style="margin-bottom: 0px">Profile: <a href="file://D:\GitHub\Touchstone\testing-ig\output/StructureDefinition-testscript.html">AEGIS Touchstone Testing TestScript Profile</a></p></div><blockquote><p><b>AEGIS Touchstone Testing TestScript Rule Extension</b></p><ul><li>ruleId: AssertBodyExists</li><li>path: /FHIRCommon/_reference/rule/AssertBodyExists.groovy</li></ul></blockquote><p><b>StructureDefinition Work Group</b>: cbcc</p><p><b>url</b>: <a href="TestScript-02-Create-subscription-then-handshake.html">TestScript 04 Basic REST-hook Subs - All SUT | 02 Create subscription then handshake</a></p><p><b>version</b>: 1.0.0-ballot</p><p><b>name</b>: Test_02_Create_subscription_then_handshake</p><p><b>title</b>: 04 Basic REST-hook Subs - All SUT | 02 Create subscription then handshake</p><p><b>status</b>: Active</p><p><b>date</b>: 2026-03-30</p><p><b>publisher</b>: HL7 International / Community Based Collaborative Care</p><p><b>contact</b>: HL7 International / Community Based Collaborative Care: <a href="http://www.hl7.org/Special/committees/cbcc">http://www.hl7.org/Special/committees/cbcc</a></p><p><b>description</b>: </p><div><p>Alternate success: Create a Subscriptions R5 Backport REST-hook Subscription followed by a handshake.
Test a client and server to verify support for POST of a REST-hook Subscription. This scenario includes the
optional step of the Consent Server sending a handshake.
This scenario is generic and can be used with any FHIR format and query parameters.
Test case supporting the FAST Consent Management IG Version: CI.
See https://wildfhir4.wildfhir.org/ig/fhir-consent-management-tg/rtm_test_cases.html#testcase-232
Test System Details (in order of appearance):
[Origin 1: Consent Client's RESTful client. System Under Test: this must be an external test system (not Touchstone).]
[Destination 1: Consent Admin Service's RESTful FHIR Server. System Under Test: this must be an external test system (not a mock).]
[Origin 2: Consent Admin Service's Subscription REST-hook notification sender. System Under Test: this must be an external test system (not Touchstone).]
[Destination 2: Consent Client's Subscription REST-hook notification endpoint. System Under Test: this must be an external test system (not a mock).]</p>
</div><p><b>jurisdiction</b>: <span title="Codes:{urn:iso:std:iso:3166 US}">United States of America</span></p><p><b>copyright</b>: </p><div><p>(c) AEGIS.net, Inc. 2026</p>
</div><blockquote><p><b>origin</b></p><p><b>index</b>: 1</p><p><b>profile</b>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-testscript-profile-origin-types.html#testscript-profile-origin-types-FHIR-Client">Test script profile origin type: FHIR-Client</a> (FHIR Client)</p></blockquote><blockquote><p><b>origin</b></p><p><b>index</b>: 2</p><p><b>profile</b>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-testscript-profile-origin-types.html#testscript-profile-origin-types-FHIR-Client">Test script profile origin type: FHIR-Client</a> (FHIR Client)</p></blockquote><blockquote><p><b>destination</b></p><p><b>index</b>: 1</p><p><b>profile</b>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-testscript-profile-destination-types.html#testscript-profile-destination-types-FHIR-Server">Test script profile destination type: FHIR-Server</a> (FHIR Server)</p></blockquote><blockquote><p><b>destination</b></p><p><b>index</b>: 2</p><p><b>profile</b>: <a href="http://terminology.hl7.org/7.1.0/CodeSystem-testscript-profile-destination-types.html#testscript-profile-destination-types-FHIR-Server">Test script profile destination type: FHIR-Server</a> (FHIR Server)</p></blockquote><p><b>profile</b>: </p><ul><li><a href="http://hl7.org/fhir/us/consent-management/2026Jan/StructureDefinition-FASTSubscription.html">http://hl7.org/fhir/us/consent-management/StructureDefinition/FASTSubscription</a></li><li><a href="http://hl7.org/fhir/R4/subscription.html">http://hl7.org/fhir/StructureDefinition/Subscription</a></li><li><a href="http://hl7.org/fhir/R4/bundle.html">http://hl7.org/fhir/StructureDefinition/Bundle</a></li></ul><h3>Variables</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Name</b></td><td><b>Description</b></td><td><b>Hint</b></td></tr><tr><td style="display: none">*</td><td>dest-2-FHIRR5BackportNotification-1-needed-notification-endpoint</td><td>Consent Client's 's REST Hook Subscription notification endpoint, available at Destination 2.</td><td>[Enter Consent Client's 's REST Hook Subscription notification endpoint, available at Destination 2]</td></tr></table><blockquote><p><b>test</b></p><p><b>name</b>: Step_001_POST_Subscription_create</p><p><b>description</b>: Consent Client creates with POST a Subscription resource at Consent Admin Service.</p><blockquote><p><b>action</b></p><h3>Operations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Type</b></td><td><b>Resource</b></td><td><b>Description</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Method</b></td><td><b>Origin</b></td><td><b>RequestId</b></td><td><b>ResponseId</b></td><td><b>Url</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/7.1.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-create">Test script operation code: create</a> (Create)</td><td>Subscription</td><td>Create a Subscription resource.</td><td>1</td><td>true</td><td>POST</td><td>1</td><td>dest-1-FHIRCreate-1-request</td><td>dest-1-FHIRCreate-1-response</td><td>${dest1SystemConfig.baseUrl}/Subscription</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request body exists.</td><td>request</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request body is a Subscription resource.</td><td>request</td><td>Subscription</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request body conforms to the base FHIR Subscription profile. This also checks any declared profiles within.</td><td>request</td><td>Subscription-profile</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>SourceId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the returned HTTP status is 201 Created.</td><td>response</td><td>in</td><td>201</td><td>dest-1-FHIRCreate-1-response</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the response body exists.</td><td>response</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the response body is a Subscription resource.</td><td>response</td><td>Subscription</td><td>true</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the response body conforms to the base FHIR Subscription profile. This also checks any declared profiles within.</td><td>response</td><td>Subscription-profile</td><td>true</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>SourceId</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request body is a Subscription resource that should declare the FASTSubscription profile.</td><td>request</td><td>Subscription.meta.profile contains 'https://hl7.org/fhir/us/consent-management/StructureDefinition/FASTSubscription'</td><td>equals</td><td>dest-1-FHIRCreate-1-request</td><td>true</td><td>true</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the resource(s) in the request body at FHIRPath 'Subscription' should conform to profile 'FASTSubscription'.</td><td>request</td><td>Subscription</td><td>FASTSubscription</td><td>true</td></tr></table></blockquote></blockquote><blockquote><p><b>test</b></p><p><b>name</b>: Step_002_Send_Subscription_notification</p><p><b>description</b>: Consent Admin Service sends a Subscription notification to Consent Client's notification endpoint.</p><blockquote><p><b>action</b></p><blockquote><p><b>operation</b></p><p><b>type</b>: <a href="file://D:\GitHub\Touchstone\testing-ig\output/CodeSystem-codesystem-fhir-operation-codes.html#codesystem-fhir-operation-codes-post">AEGIS Touchstone Testing FHIR Operation Codes: post</a> (POST)</p><p><b>resource</b>: Bundle</p><p><b>description</b>: POST a Subscriptions R5 Backport REST-hook Notification Bundle.</p><p><b>contentType</b>: json</p><p><b>destination</b>: 2</p><p><b>encodeRequestUrl</b>: true</p><p><b>method</b>: POST</p><p><b>origin</b>: 2</p><h3>RequestHeaders</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Field</b></td><td><b>Value</b></td></tr><tr><td style="display: none">*</td><td>Authorization</td><td>none</td></tr></table><p><b>requestId</b>: dest-2-FHIRR5BackportNotification-1-request</p><p><b>responseId</b>: dest-2-FHIRR5BackportNotification-1-response</p><p><b>url</b>: ${dest-2-FHIRR5BackportNotification-1-needed-notification-endpoint}</p></blockquote></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Operator</b></td><td><b>ResponseCode</b></td><td><b>SourceId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the returned HTTP status is 200 OK.</td><td>response</td><td>in</td><td>200</td><td>dest-2-FHIRR5BackportNotification-1-response</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request body exists.</td><td>request</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Resource</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request resource type is Bundle.</td><td>request</td><td>Bundle</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>ValidateProfileId</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request Bundle conforms to the base FHIR Bundle profile. This also validates the contents against any declared profiles.</td><td>request</td><td>Bundle-profile</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request Bundle type is history.</td><td>request</td><td>Bundle.type</td><td>equals</td><td>history</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the request Bundle declares the backport-subscription-notification-r4 profile.</td><td>request</td><td>Bundle.where('http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-subscription-notification-r4' in meta.profile).exists()</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>SourceId</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the Notification type is handshake.</td><td>request</td><td>Bundle.entry.resource.ofType(Parameters).parameter.where(name='type').value = 'handshake'</td><td>equals</td><td>dest-2-FHIRR5BackportNotification-1-request</td><td>true</td><td>false</td></tr></table></blockquote><blockquote><p><b>action</b></p><h3>Asserts</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Extension</b></td><td><b>Description</b></td><td><b>Direction</b></td><td><b>Expression</b></td><td><b>Operator</b></td><td><b>SourceId</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that every Consent resource in the request declares the FASTConsent profile.</td><td>request</td><td>Bundle.entry.resource.where(resourceType = 'Consent').all('https://hl7.org/fhir/us/consent-management/StructureDefinition/FASTConsent' in meta.profile)</td><td>equals</td><td>dest-2-FHIRR5BackportNotification-1-request</td><td>true</td><td>false</td></tr></table></blockquote></blockquote></div>
  </text>
  <extension
             url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule">
    <extension url="ruleId">
      <valueId value="AssertBodyExists"/>
    </extension>
    <extension url="path">
      <valueString
                   value="/FHIRCommon/_reference/rule/AssertBodyExists.groovy"/>
    </extension>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="cbcc"/>
  </extension>
  <url
       value="http://hl7.org/fhir/us/consent-management-tg/TestScript/02-Create-subscription-then-handshake"/>
  <version value="1.0.0-ballot"/>
  <name value="Test_02_Create_subscription_then_handshake"/>
  <title
         value="04 Basic REST-hook Subs - All SUT | 02 Create subscription then handshake"/>
  <status value="active"/>
  <date value="2026-03-30"/>
  <publisher value="HL7 International / Community Based Collaborative Care"/>
  <contact>
    <name value="HL7 International / Community Based Collaborative Care"/>
    <telecom>
      <system value="url"/>
      <value value="http://www.hl7.org/Special/committees/cbcc"/>
    </telecom>
  </contact>
  <description
               value="Alternate success: Create a Subscriptions R5 Backport REST-hook Subscription followed by a handshake.
Test a client and server to verify support for POST of a REST-hook Subscription. This scenario includes the
optional step of the Consent Server sending a handshake.
This scenario is generic and can be used with any FHIR format and query parameters.
Test case supporting the FAST Consent Management IG Version: CI.
See https://wildfhir4.wildfhir.org/ig/fhir-consent-management-tg/rtm_test_cases.html#testcase-232
 Test System Details (in order of appearance):
 [Origin 1: Consent Client's RESTful client. System Under Test: this must be an external test system (not Touchstone).]
 [Destination 1: Consent Admin Service's RESTful FHIR Server. System Under Test: this must be an external test system (not a mock).]
 [Origin 2: Consent Admin Service's Subscription REST-hook notification sender. System Under Test: this must be an external test system (not Touchstone).]
 [Destination 2: Consent Client's Subscription REST-hook notification endpoint. System Under Test: this must be an external test system (not a mock).]"/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="US"/>
      <display value="United States of America"/>
    </coding>
  </jurisdiction>
  <copyright value="(c) AEGIS.net, Inc. 2026"/>
  <origin>
    <index value="1"/>
    <profile>
      <system
              value="http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"/>
      <code value="FHIR-Client"/>
    </profile>
  </origin>
  <origin>
    <index value="2"/>
    <profile>
      <system
              value="http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types"/>
      <code value="FHIR-Client"/>
    </profile>
  </origin>
  <destination>
    <index value="1"/>
    <profile>
      <system
              value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>
      <code value="FHIR-Server"/>
    </profile>
  </destination>
  <destination>
    <index value="2"/>
    <profile>
      <system
              value="http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types"/>
      <code value="FHIR-Server"/>
    </profile>
  </destination>
  <profile id="FASTSubscription">🔗 
    <reference
               value="http://hl7.org/fhir/us/consent-management/StructureDefinition/FASTSubscription"/>
  </profile>
  <profile id="Subscription-profile">🔗 
    <reference value="http://hl7.org/fhir/StructureDefinition/Subscription"/>
  </profile>
  <profile id="Bundle-profile">🔗 
    <reference value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
  </profile>
  <variable>
    <name
          value="dest-2-FHIRR5BackportNotification-1-needed-notification-endpoint"/>
    <description
                 value="Consent Client's 's REST Hook Subscription notification endpoint, available at Destination 2."/>
    <hint
          value="[Enter Consent Client's 's REST Hook Subscription notification endpoint, available at Destination 2]"/>
  </variable>
  <test>
    <name value="Step_001_POST_Subscription_create"/>
    <description
                 value="Consent Client creates with POST a Subscription resource at Consent Admin Service."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="create"/>
        </type>
        <resource value="Subscription"/>
        <description value="Create a Subscription resource."/>
        <destination value="1"/>
        <encodeRequestUrl value="true"/>
        <method value="post"/>
        <origin value="1"/>
        <requestId value="dest-1-FHIRCreate-1-request"/>
        <responseId value="dest-1-FHIRCreate-1-response"/>
        <url value="${dest1SystemConfig.baseUrl}/Subscription"/>
      </operation>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule">
          <extension url="ruleId">
            <valueId value="AssertBodyExists"/>
          </extension>
          <extension url="param">
            <extension url="name">
              <valueString value="errorMessage"/>
            </extension>
            <extension url="value">
              <valueString value="the request body does not exist."/>
            </extension>
          </extension>
        </extension>
        <description value="Confirm that the request body exists."/>
        <direction value="request"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request body is a Subscription resource."/>
        <direction value="request"/>
        <resource value="Subscription"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request body conforms to the base FHIR Subscription profile. This also checks any declared profiles within."/>
        <direction value="request"/>
        <validateProfileId value="Subscription-profile"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the returned HTTP status is 201 Created."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="201"/>
        <sourceId value="dest-1-FHIRCreate-1-response"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule">
          <extension url="ruleId">
            <valueId value="AssertBodyExists"/>
          </extension>
          <extension url="param">
            <extension url="name">
              <valueString value="errorMessage"/>
            </extension>
            <extension url="value">
              <valueString value="the response body does not exist."/>
            </extension>
          </extension>
        </extension>
        <description value="Confirm that the response body exists."/>
        <direction value="response"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the response body is a Subscription resource."/>
        <direction value="response"/>
        <resource value="Subscription"/>
        <warningOnly value="true"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the response body conforms to the base FHIR Subscription profile. This also checks any declared profiles within."/>
        <direction value="response"/>
        <validateProfileId value="Subscription-profile"/>
        <warningOnly value="true"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request body is a Subscription resource that should declare the FASTSubscription profile."/>
        <direction value="request"/>
        <expression
                    value="Subscription.meta.profile contains 'https://hl7.org/fhir/us/consent-management/StructureDefinition/FASTSubscription'"/>
        <operator value="equals"/>
        <sourceId value="dest-1-FHIRCreate-1-request"/>
        <value value="true"/>
        <warningOnly value="true"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the resource(s) in the request body at FHIRPath 'Subscription' should conform to profile 'FASTSubscription'."/>
        <direction value="request"/>
        <expression value="Subscription"/>
        <validateProfileId value="FASTSubscription"/>
        <warningOnly value="true"/>
      </assert>
    </action>
  </test>
  <test>
    <name value="Step_002_Send_Subscription_notification"/>
    <description
                 value="Consent Admin Service sends a Subscription notification to Consent Client's notification endpoint."/>
    <action>
      <operation>
        <type>
          <system
                  value="http://touchstone.aegis.net/touchstone/fhir/testing/CodeSystem/codesystem-fhir-operation-codes"/>
          <code value="post"/>
        </type>
        <resource value="Bundle"/>
        <description
                     value="POST a Subscriptions R5 Backport REST-hook Notification Bundle."/>
        <contentType value="json"/>
        <destination value="2"/>
        <encodeRequestUrl value="true"/>
        <method value="post"/>
        <origin value="2"/>
        <requestHeader>
          <field value="Authorization"/>
          <value value="none"/>
        </requestHeader>
        <requestId value="dest-2-FHIRR5BackportNotification-1-request"/>
        <responseId value="dest-2-FHIRR5BackportNotification-1-response"/>
        <url
             value="${dest-2-FHIRR5BackportNotification-1-needed-notification-endpoint}"/>
      </operation>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the returned HTTP status is 200 OK."/>
        <direction value="response"/>
        <operator value="in"/>
        <responseCode value="200"/>
        <sourceId value="dest-2-FHIRR5BackportNotification-1-response"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule">
          <extension url="ruleId">
            <valueId value="AssertBodyExists"/>
          </extension>
          <extension url="param">
            <extension url="name">
              <valueString value="errorMessage"/>
            </extension>
            <extension url="value">
              <valueString value="the request body does not exist."/>
            </extension>
          </extension>
        </extension>
        <description value="Confirm that the request body exists."/>
        <direction value="request"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request resource type is Bundle."/>
        <direction value="request"/>
        <resource value="Bundle"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request Bundle conforms to the base FHIR Bundle profile. This also validates the contents against any declared profiles."/>
        <direction value="request"/>
        <validateProfileId value="Bundle-profile"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request Bundle type is history."/>
        <direction value="request"/>
        <expression value="Bundle.type"/>
        <operator value="equals"/>
        <value value="history"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the request Bundle declares the backport-subscription-notification-r4 profile."/>
        <direction value="request"/>
        <expression
                    value="Bundle.where('http://hl7.org/fhir/uv/subscriptions-backport/StructureDefinition/backport-subscription-notification-r4' in meta.profile).exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that the Notification type is handshake."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.ofType(Parameters).parameter.where(name='type').value = 'handshake'"/>
        <operator value="equals"/>
        <sourceId value="dest-2-FHIRR5BackportNotification-1-request"/>
        <value value="true"/>
        <warningOnly value="false"/>
      </assert>
    </action>
    <action>
      <assert>
        <extension
                   url="http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail">
          <valueBoolean value="false"/>
        </extension>
        <description
                     value="Confirm that every Consent resource in the request declares the FASTConsent profile."/>
        <direction value="request"/>
        <expression
                    value="Bundle.entry.resource.where(resourceType = 'Consent').all('https://hl7.org/fhir/us/consent-management/StructureDefinition/FASTConsent' in meta.profile)"/>
        <operator value="equals"/>
        <sourceId value="dest-2-FHIRR5BackportNotification-1-request"/>
        <value value="true"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
</TestScript>