<?xml version="1.0" encoding="UTF-8"?>

<TestScript xmlns="http://hl7.org/fhir">
  <id value="fastconsentcapabilitiesjson"/>
  <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 fastconsentcapabilitiesjson</b></p><a name="fastconsentcapabilitiesjson"> </a><a name="hcfastconsentcapabilitiesjson"> </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><p><b>StructureDefinition Work Group</b>: cbcc</p><p><b>url</b>: <a href="TestScript-fastconsentcapabilitiesjson.html">TestScript FAST Consent Capabilities JSON</a></p><p><b>version</b>: 0.1.0</p><p><b>name</b>: FASTConsentCapabilitiesJSON</p><p><b>title</b>: FAST Consent Capabilities JSON</p><p><b>status</b>: Active</p><p><b>date</b>: 2025-05-22</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>Test a FAST Consent Management Server CapabilityStatement using JSON Format</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) HL7 International / Community Based Collaborative Care 2025</p>
</div><h3>Origins</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td style="display: none">*</td><td>1</td><td><a href="http://terminology.hl7.org/6.5.0/CodeSystem-testscript-profile-origin-types.html#testscript-profile-origin-types-FHIR-Client">Test script profile origin type FHIR-Client</a>: FHIR Client</td></tr></table><h3>Destinations</h3><table class="grid"><tr><td style="display: none">-</td><td><b>Index</b></td><td><b>Profile</b></td></tr><tr><td style="display: none">*</td><td>1</td><td><a href="http://terminology.hl7.org/6.5.0/CodeSystem-testscript-profile-destination-types.html#testscript-profile-destination-types-FHIR-Server">Test script profile destination type FHIR-Server</a>: FHIR Server</td></tr></table><p><b>profile</b>: <a href="http://hl7.org/fhir/R4/capabilitystatement.html">http://hl7.org/fhir/StructureDefinition/CapabilityStatement</a></p><blockquote><p><b>test</b></p><blockquote><p><b>id</b></p>FASTConsentCapabilitiesJSON</blockquote><p><b>name</b>: FASTConsentCapabilitiesJSON</p><p><b>description</b>: Test a FAST Consent Management Server CapabilityStatement using JSON Format against the destination server and assert successful response.</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>Description</b></td><td><b>Accept</b></td><td><b>ContentType</b></td><td><b>Destination</b></td><td><b>EncodeRequestUrl</b></td><td><b>Origin</b></td><td><b>Params</b></td></tr><tr><td style="display: none">*</td><td><a href="http://terminology.hl7.org/6.5.0/CodeSystem-testscript-operation-codes.html#testscript-operation-codes-metadata">Test script operation code metadata</a>: metadata</td><td>Get the CapabilityStatement</td><td>json</td><td>json</td><td>1</td><td>true</td><td>1</td><td>metadata</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>ResponseCode</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the returned response code is 200 OK.</td><td>response</td><td>200</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 returned response payload is a CapabilityStatement resource.</td><td>response</td><td>CapabilityStatement</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 returned CapabilityStatement conforms to the base FHIR specification.</td><td>response</td><td>CapabilityStatementProfile</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>Path</b></td><td><b>Value</b></td><td><b>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the returned CapabilityStatement contains the fhirVersion 4.0.1.</td><td>response</td><td>$.fhirVersion</td><td>4.0.1</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 returned CapabilityStatement declares support for the Consent resource.</td><td>response</td><td>CapabilityStatement.rest.where(mode = 'server').resource.where(type = 'Consent').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>WarningOnly</b></td></tr><tr><td style="display: none">*</td><td/><td>Confirm that the returned CapabilityStatement declares support for the FAST Consent profile.</td><td>response</td><td>CapabilityStatement.rest.where(mode = 'server').resource.where(type = 'Consent' and supportedProfile = 'http://hl7.org/fhir/us/consent-management/StructureDefinition/FASTConsent').exists()</td><td>false</td></tr></table></blockquote></blockquote></div>
  </text>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="cbcc"/>
  </extension>
  <url value="http://hl7.org/fhir/us/consent-management-tg/TestScript/fastconsentcapabilitiesjson"/>
  <version value="0.1.0"/>
  <name value="FASTConsentCapabilitiesJSON"/>
  <title value="FAST Consent Capabilities JSON"/>
  <status value="active"/>
  <date value="2025-05-22"/>
  <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="Test a FAST Consent Management Server CapabilityStatement using JSON Format"/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="US"/>
      <display value="United States of America"/>
    </coding>
  </jurisdiction>
  <copyright value="(c) HL7 International / Community Based Collaborative Care 2025"/>
  <origin>
    <index value="1"/>
    <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>
  <profile id="CapabilityStatementProfile">
    <reference value="http://hl7.org/fhir/StructureDefinition/CapabilityStatement"/>
  </profile>
  <test id="FASTConsentCapabilitiesJSON">
    <name value="FASTConsentCapabilitiesJSON"/>
    <description value="Test a FAST Consent Management Server CapabilityStatement using JSON Format against the destination server and assert successful response."/>
    <action>
      <operation>
        <type>
          <system value="http://terminology.hl7.org/CodeSystem/testscript-operation-codes"/>
          <code value="metadata"/>
        </type>
        <description value="Get the CapabilityStatement"/>
        <accept value="json"/>
        <contentType value="json"/>
        <destination value="1"/>
        <encodeRequestUrl value="true"/>
        <origin value="1"/>
        <params value="metadata"/>
      </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 response code is 200 OK."/>
        <direction value="response"/>
        <responseCode value="200"/>
        <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 response payload is a CapabilityStatement resource."/>
        <direction value="response"/>
        <resource value="CapabilityStatement"/>
        <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 CapabilityStatement conforms to the base FHIR specification."/>
        <direction value="response"/>
        <validateProfileId value="CapabilityStatementProfile"/>
        <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 CapabilityStatement contains the fhirVersion 4.0.1."/>
        <direction value="response"/>
        <path value="$.fhirVersion"/>
        <value value="4.0.1"/>
        <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 CapabilityStatement declares support for the Consent resource."/>
        <direction value="response"/>
        <expression value="CapabilityStatement.rest.where(mode = 'server').resource.where(type = 'Consent').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 returned CapabilityStatement declares support for the FAST Consent profile."/>
        <direction value="response"/>
        <expression value="CapabilityStatement.rest.where(mode = 'server').resource.where(type = 'Consent' and supportedProfile = 'http://hl7.org/fhir/us/consent-management/StructureDefinition/FASTConsent').exists()"/>
        <warningOnly value="false"/>
      </assert>
    </action>
  </test>
</TestScript>