Mock Field Definitions
- 05 Dec 2022
-
DarkLight
-
PDF
Mock Field Definitions
- Updated on 05 Dec 2022
-
DarkLight
-
PDF
Article summary
Did you find this summary helpful?
Thank you for your feedback
Mock data is simply the response from the other system. It will typically be JSON, but it should match the datatype or responseDatatype that is defined in the action.json.
- In this example, all the fields are unique to the response and determined by the external system.
Sample Mock Data
{
"data": {
"authentication": {
"authentication-method": [
{
"priority": 1,
"scope": "remote",
"statistics": {
"called": 2,
"failure": 3,
"skipped": 10,
"success": 10
},
"type": "tacacs"
}
]
}
}
}
- There is also an older format for mock data that allows you to put status information into the response (for testing purposes, i.e. errors).
- status: This field represents the status code that is returned from the other system. It is not part of the mock data. To test out an error, the status field can be set to an error code.
- response: This is the object that will contain the mock data. Instead of just putting the mock data into the file, it should be added in the response object.
- Since mock data is not an actual HTTP response, it does not contain headers to specify information such as the status of the request. Therefore, including a status can be beneficial.
Sample Mock Data
{
"status": 200,
"response": {
"allowDelete":true,
"alternateName":"string",
"dateAdded":0,
"description":"TESTING",
"disableConcurrentPolling":true,
"disablePolling":true,
"disableThresholding":true,
"id":1245,
"ipAddress":"10.10.10.1",
"isDeleted":true,
"isNew":true,
"lastDiscovery":0,
"name":"Michael1",
"numElements":0,
"pluginManagerId":0
}
}
Was this article helpful?