Module test

Source
Expand description

Various helpers for Actix applications to use during testing.

§Creating A Test Service

§Off-The-Shelf Test Services

§Calling Test Service

§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§

TestBuffer
Async I/O test buffer.
TestRequest
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.