testtube.HttpTestHistory

HttpTestHistory manages http request and response history for a HttpTest.

Class

class testtube.HttpTestHistory()

Properties

length
integer
Description The number of saeed requests/responses.

Methods

addReqSpec  
Arguments
  • name (string) – a handle that can later be used to retrieve the reqSpec
  • reqSpec (object) – the reqSpec to record
Description Add a reqSpec to the history.
addResSpec  
Arguments
  • name (string) – a handle that can later be used to retrieve the resSpec
  • resSpec (object) – the resSpec to record
Description Add a resSpec to the history.
addReq  
Arguments
  • name (string) – a handle that can later be used to retrieve the req
  • req (object) – the req to record
Description Add a req to the history.
addRes  
Arguments
  • name (string) – a handle that can later be used to retrieve the res
  • req (object) – the res to record
Description Add a res to the history.
getReqSpec  
Arguments
  • index (string | integer) – the index of the reqSpec to retrieve
Returns reqSpec
Raises RangeError
Description Retrieve the reqSpec at index, where index can be a test name, a negative integer to walk backward from the current request/response cycle, or a positive integer to walk forward from the beginning of the test suite.
getResSpec  
Arguments
  • index (string | integer) – the index of the resSpec to retrieve
Returns resSpec
Raises RangeError
Description Retrieve the resSpec at index (see getReqSpec for description of index).
getReq  
Arguments
  • index (string | integer) – the index of the req to retrieve
Returns req
Raises RangeError
Description Retrieve the req at index (see getReqSpec for description of index).
getRes  
Arguments
  • index (string | integer) – the index of the res to retrieve
Returns res
Raises RangeError
Description Retrieve the res at index (see getReqSpec for description of index).
get  
Arguments
  • index (string | integer) – the index of the request/response cycle to retrieve
Returns an object that contains the reqSpec, resSpec, req, and res for index
Raises RangeError
Description Retrieve all history at index (see getReqSpec for description of index).

Example