Struct finchers::test::TestRunner [−][src]
pub struct TestRunner<E> { /* fields omitted */ }
A test runner for emulating the behavior of endpoints in the server.
It uses internally the current thread version of Tokio runtime for executing asynchronous processes.
Methods
impl<E> TestRunner<E>
[src]
impl<E> TestRunner<E>
pub fn new(endpoint: E) -> Result<TestRunner<E>> where
E: Endpoint<'e>,
[src]
pub fn new(endpoint: E) -> Result<TestRunner<E>> where
E: Endpoint<'e>,
Create a TestRunner
from the specified endpoint.
pub fn with_runtime(endpoint: E, rt: Runtime) -> TestRunner<E> where
E: Endpoint<'e>,
[src]
pub fn with_runtime(endpoint: E, rt: Runtime) -> TestRunner<E> where
E: Endpoint<'e>,
Create a TestRunner
from the specified endpoint with a Tokio runtime.
pub fn default_headers(&mut self) -> &mut HeaderMap
[src]
pub fn default_headers(&mut self) -> &mut HeaderMap
Returns a reference to the header map, whose values are set before applying the request to endpoint.
pub fn endpoint(&mut self) -> &mut E
[src]
pub fn endpoint(&mut self) -> &mut E
Returns a reference to the instance of Endpoint
owned by this runner.
pub fn runtime(&mut self) -> &mut Runtime
[src]
pub fn runtime(&mut self) -> &mut Runtime
Returns a reference to the Tokio runtime managed by this runner.
pub fn apply<'a, T>(
&'a mut self,
request: impl TestRequest
) -> Result<T> where
E: Endpoint<'a, Output = (T,)>,
[src]
pub fn apply<'a, T>(
&'a mut self,
request: impl TestRequest
) -> Result<T> where
E: Endpoint<'a, Output = (T,)>,
Applies the given request to the inner endpoint and retrieves the result of returned future.
This method is available only if the output of endpoint is a tuple with a single element.
If the output type is an unit or the tuple contains more than one element, use apply_raw
instead.
pub fn apply_raw<'a>(
&'a mut self,
request: impl TestRequest
) -> Result<E::Output> where
E: Endpoint<'a>,
[src]
pub fn apply_raw<'a>(
&'a mut self,
request: impl TestRequest
) -> Result<E::Output> where
E: Endpoint<'a>,
Applies the given request to the inner endpoint and retrieves the result of returned future without peeling tuples.
pub fn perform<'a>(
&'a mut self,
request: impl TestRequest
) -> Result<Response<TestResult>, Box<StdError + Send + Sync + 'static>> where
E: Endpoint<'a>,
E::Output: Output,
[src]
pub fn perform<'a>(
&'a mut self,
request: impl TestRequest
) -> Result<Response<TestResult>, Box<StdError + Send + Sync + 'static>> where
E: Endpoint<'a>,
E::Output: Output,
Applies the given request to the endpoint and convert the result into an HTTP response sent to the client.
Trait Implementations
impl<E: Debug> Debug for TestRunner<E>
[src]
impl<E: Debug> Debug for TestRunner<E>
Auto Trait Implementations
impl<E> !Send for TestRunner<E>
impl<E> !Send for TestRunner<E>
impl<E> !Sync for TestRunner<E>
impl<E> !Sync for TestRunner<E>