Skip to navigation

ESignatureAPIMock

View as Markdown
@IsTest global class ESignatureAPIMock extends OAuthTokenMock implements HttpCalloutMock
Description
Test mock for the Docusign eSignature REST API. Numerous service methods result in a callout to Docusign, so the web service API must be mocked.

Service methods also require a user with the DocuSign Administrator or DocuSign User permission set as well as a Docusign test account configuration. The dfsle.UserMock.createDocuSignAdministrator and dfsle.UserMock.createDocuSignUser test helper methods are typically used in conjunction with the web service API mock to accomplish this. Example:

 static testMethod void myTest() {
   dfsle.ESignatureAPIMock().success();
   System.runAs(dfsle.UserMock.createDocuSignUser()) {
     // Call Docusign service methods
   }
 }
 

Methods

Description
Constructs a new success mock for the Docusign eSignature REST API.
global ESignatureAPIMock(final Boolean success)
Description
Constructs a new mock for the Docusign eSignature REST API.
Parameters
success
final Boolean success
Whether the requests should be successful.
global static ESignatureAPIMock failure()
Description
Factory constructor for the Docusign eSignature REST API with failure responses. This also sets the test mock via dfsle.Test.setMock.
Returns
The failure API test mock.
global static ESignatureAPIMock success()
Description
Factory constructor for the Docusign eSignature REST API with success responses. This also sets the test mock via dfsle.Test.setMock.
Returns
The success API test mock.