Expand description
Various helpers for Actix applications to use during testing.
§Creating A Test Service
§Off-The-Shelf Test Services
§Calling Test Service
TestRequest
call_service
try_call_service
call_and_read_body
call_and_read_body_json
try_call_and_read_body_json
§Reading Response Payloads
Re-exports§
pub use self::test_services::default_service;
Deprecated pub use self::test_services::simple_service;
Deprecated pub use self::test_utils::read_response;
Deprecated pub use self::test_utils::read_response_json;
Deprecated
Structs§
- Test
Buffer - Async I/O test buffer.
- Test
Request - Test
Request
builder.
Functions§
- call_
and_ read_ body - Helper function that returns a response body of a TestRequest
- call_
and_ read_ body_ json - Helper function that returns a deserialized response body of a TestRequest
- call_
service - Calls service and waits for response future completion.
- init_
service - Initialize service from application builder instance.
- ok_
service - Creates service that always responds with
200 OK
and no body. - read_
body - Helper function that returns a response body of a ServiceResponse.
- read_
body_ json - Helper function that returns a deserialized response body of a ServiceResponse.
- status_
service - Creates service that always responds with given status code and no body.
- try_
call_ and_ read_ body_ json - Fallible version of
call_and_read_body_json
that allows testing service call errors. - try_
call_ service - Fallible version of
call_service
that allows testing response completion errors. - try_
read_ body - Fallible version of
read_body
that allows testing MessageBody reading errors. - try_
read_ body_ json - Fallible version of
read_body_json
that allows testing response deserialization errors.