02-Operation-Revoke-a-Consent
type: TestScript
node role: treeRoot
id:
  v: 02-Operation-Revoke-a-Consent
meta:
  profile:
    v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript
    l: testscript
text:
  status:
    v: extensions
  div:
    v: Generated Narrative: TestScript 02-Operation-Revoke-a-Consent Profile: AEGIS Touchstone Testing TestScript Profile AEGIS Touchstone Testing TestScript Rule Extension ruleId: GetVariable-JsonPath path: /FHIRCommon/_reference/rule/GetVariable-JsonPath.groovy AEGIS Touchstone Testing TestScript Rule Extension ruleId: AssertBodyExists path: /FHIRCommon/_reference/rule/AssertBodyExists.groovy StructureDefinition Work Group: cbcc url: TestScript 03 Operations - All SUT | 02 Operation: Revoke a Consent version: 1.0.0-ballot name: Test_02_Operation_Revoke_a_Consent title: 03 Operations - All SUT | 02 Operation: Revoke a Consent status: Active date: 2026-03-30 publisher: HL7 International / Community Based Collaborative Care contact: HL7 International / Community Based Collaborative Care: http://www.hl7.org/Special/committees/cbcc description: Happy Path: Perform a successful Consent/$revokeConsent operation. Test a client and server to verify support for the Consent $revokeConsent operation, supporting the FAST Consent Management IG Version: CI. This scenario is generic and can be used with any FHIR format and query parameters. See https://wildfhir4.wildfhir.org/ig/fhir-consent-management-tg/rtm_test_cases.html#testcase-70 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: Touchstone's RESTful client. Simulated: this requires Touchstone to be chosen as the test system.] jurisdiction: United States of America copyright: (c) AEGIS.net, Inc. 2026 origin index: 1 profile: Test script profile origin type: FHIR-Client (FHIR Client) origin index: 2 profile: Test script profile origin type: FHIR-Client (FHIR Client) Destinations - Index Profile * 1 Test script profile destination type: FHIR-Server (FHIR Server) profile: http://hl…
extension:
  extension:
    url:
      v: ruleId
      l: ruleId
    value: Id
      v: GetVariable-JsonPath
  extension:
    url:
      v: path
      l: path
    value: String
      v: /FHIRCommon/_reference/rule/GetVariable-JsonPath.groovy
  url:
    v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule
    l: testscript-rule
extension:
  extension:
    url:
      v: ruleId
      l: ruleId
    value: Id
      v: AssertBodyExists
  extension:
    url:
      v: path
      l: path
    value: String
      v: /FHIRCommon/_reference/rule/AssertBodyExists.groovy
  url:
    v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-rule
    l: testscript-rule
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/structuredefinition-wg
    l: structuredefinition-wg
  value: Code
    v: cbcc
url:
  v: http://hl7.org/fhir/us/consent-management-tg/TestScript/02-Operation-Revoke-a-Consent
  l: 02-Operation-Revoke-a-Consent
version:
  v: 1.0.0-ballot
name:
  v: Test_02_Operation_Revoke_a_Consent
title:
  v: 03 Operations - All SUT | 02 Operation: Revoke a Consent
status:
  v: active
date:
  v: 2026-03-30
publisher:
  v: HL7 International / Community Based Collaborative Care
contact:
  name:
    v: HL7 International / Community Based Collaborative Care
  telecom:
    system:
      v: url
    value:
      v: http://www.hl7.org/Special/committees/cbcc
description:
  v: Happy Path: Perform a successful Consent/$revokeConsent operation. Test a client and server to verify support for the Consent $revokeConsent operation, supporting the FAST Consent Management IG Version: CI. This scenario is generic and can be used with any FHIR format and query parameters. See https://wildfhir4.wildfhir.org/ig/fhir-consent-management-tg/rtm_test_cases.html#testcase-70 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: Touchstone's RESTful client. Simulated: this requires Touchstone to be chosen as the test system.]
jurisdiction:
  coding:
    system:
      v: urn:iso:std:iso:3166
      l: 3166
    code:
      v: US
    display:
      v: United States of America
copyright:
  v: (c) AEGIS.net, Inc. 2026
origin:
  index:
    v: 1
  profile:
    system:
      v: http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types
      l: testscript-profile-origin-types
    code:
      v: FHIR-Client
origin:
  index:
    v: 2
  profile:
    system:
      v: http://terminology.hl7.org/CodeSystem/testscript-profile-origin-types
      l: testscript-profile-origin-types
    code:
      v: FHIR-Client
destination:
  index:
    v: 1
  profile:
    system:
      v: http://terminology.hl7.org/CodeSystem/testscript-profile-destination-types
      l: testscript-profile-destination-types
    code:
      v: FHIR-Server
profile:
  l: RevokeConsentParameters
  id:
    v: RevokeConsentParameters
  reference:
    v: http://hl7.org/fhir/us/consent-management/StructureDefinition/RevokeConsentParameters
profile:
  l: Consent
  id:
    v: Consent-profile
  reference:
    v: http://hl7.org/fhir/StructureDefinition/Consent
test:
  name:
    v: Step_001_Consent_slash_dollar_revokeConsent_operation
  description:
    v: Consent Client invokes the Consent/$revokeConsent operation at Consent Admin Service.
  action:
    operation:
      resource:
        v: Consent
      description:
        v: Consent/$revokeConsent operation.
      destination:
        v: 1
      encode request url:
        v: true
      method:
        v: post
      origin:
        v: 1
      params:
        v: /$revokeConsent
      request id:
        v: dest-1-FHIRExtendedOperation-1-request
      response id:
        v: dest-1-FHIRExtendedOperation-1-response
  action:
    assert:
      extension:
        value: Boolean
      description:
        v: Confirm that the resource(s) in the request body at FHIRPath 'Parameters' conform to profile 'RevokeConsentParameters'.
      direction:
        v: request
      expression:
        v: Parameters
      validate profile id:
        v: RevokeConsentParameters
      warning only:
        v: false
  action:
    assert:
      extension:
        value: Boolean
      description:
        v: Save the reference from the request so we can read it in the next step and check its status.
      direction:
        v: request
      source id:
        v: dest-1-FHIRExtendedOperation-1-request
      warning only:
        v: true
test:
  name:
    v: Step_002_Consent_read
  description:
    v: Touchstone reads a Consent resource at Consent Admin Service. Read the revoked Consent using the reference we saved from the $revokeConsent request, confirm it still exists, and is inactive.
  action:
    operation:
      resource:
        v: Consent
      description:
        v: Read a Consent resource.
      accept:
        v: json
      destination:
        v: 1
      encode request url:
        v: true
      method:
        v: get
      origin:
        v: 2
      request id:
        v: dest-1-FHIRRead-1-request
      response id:
        v: dest-1-FHIRRead-1-response

v: post

Boolean
v: false

Boolean
v: false

url:
  v: ruleId
  l: ruleId
value: Id
  v: GetVariable-JsonPath

extension:
  url:
    v: name
    l: name
  value: String
    v: jsonPath
extension:
  url:
    v: value
    l: value
  value: String
    v: $.parameter[?(@.name == 'consent')].valueReference.reference
url:
  v: param
  l: param

extension:
  url:
    v: name
    l: name
  value: String
    v: outputName
extension:
  url:
    v: value
    l: value
  value: String
    v: ConsentReference
url:
  v: param
  l: param

extension:
  url:
    v: name
    l: name
  value: String
    v: ConsentReference
url:
  v: output
  l: output

v: read

assert:
  extension:
    url:
      v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail
      l: testscript-assert-stopTestOnFail
    value: Boolean
      v: false
  description:
    v: Confirm that the returned HTTP status is 200 OK.
  direction:
    v: response
  operator:
    v: in
  response code:
    v: 200
  source id:
    v: dest-1-FHIRRead-1-response
  warning only:
    v: false

assert:
  extension:
    extension:
      url:
        v: ruleId
        l: ruleId
      value: Id
        v: AssertBodyExists
    extension:
      extension:
        value: String
      extension:
        value: String
      url:
        v: param
        l: param
    url:
      v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-rule
      l: testscript-assert-rule
  description:
    v: Confirm that the response body exists.
  direction:
    v: response
  warning only:
    v: false

v: name
l: name

String
v: errorMessage

v: value
l: value

String
v: the response body does not exist.

assert:
  extension:
    url:
      v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail
      l: testscript-assert-stopTestOnFail
    value: Boolean
      v: false
  description:
    v: Confirm that the response body is a Consent resource.
  direction:
    v: response
  resource:
    v: Consent
  warning only:
    v: false

assert:
  extension:
    url:
      v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail
      l: testscript-assert-stopTestOnFail
    value: Boolean
      v: false
  description:
    v: Confirm that the response body conforms to the base FHIR Consent profile. This also checks any declared profiles within.
  direction:
    v: response
  validate profile id:
    v: Consent-profile
  warning only:
    v: false

assert:
  extension:
    url:
      v: http://touchstone.aegis.net/touchstone/fhir/testing/StructureDefinition/testscript-assert-stopTestOnFail
      l: testscript-assert-stopTestOnFail
    value: Boolean
      v: false
  description:
    v: Confirm the status of the Consent just revoked is inactive.
  direction:
    v: response
  expression:
    v: Consent.status = 'inactive'
  operator:
    v: equals
  source id:
    v: dest-1-FHIRRead-1-response
  value:
    v: true
  warning only:
    v: false