pub struct TestApplication { /* private fields */ }Expand description
Re-exported public API. In-process Caelix application for integration tests.
Builds the same DI container and route table as production, then serves requests through Actix’s test service (no TCP listener).
Implementations§
Source§impl TestApplication
impl TestApplication
Sourcepub fn new<M>() -> TestApplicationBuilder<M>where
M: Module + 'static,
pub fn new<M>() -> TestApplicationBuilder<M>where
M: Module + 'static,
Start configuring a test application for module M.
ⓘ
let app = TestApplication::new::<AppModule>().await;
let app = TestApplication::new::<AppModule>()
.override_provider(UserRepository::in_memory())
.await;Sourcepub fn get(&self, path: &str) -> TestRequestBuilder<'_>
pub fn get(&self, path: &str) -> TestRequestBuilder<'_>
Runs the get public API operation.
Sourcepub fn post(&self, path: &str) -> TestRequestBuilder<'_>
pub fn post(&self, path: &str) -> TestRequestBuilder<'_>
Runs the post public API operation.
Sourcepub fn put(&self, path: &str) -> TestRequestBuilder<'_>
pub fn put(&self, path: &str) -> TestRequestBuilder<'_>
Runs the put public API operation.
Sourcepub fn patch(&self, path: &str) -> TestRequestBuilder<'_>
pub fn patch(&self, path: &str) -> TestRequestBuilder<'_>
Runs the patch public API operation.
Sourcepub fn delete(&self, path: &str) -> TestRequestBuilder<'_>
pub fn delete(&self, path: &str) -> TestRequestBuilder<'_>
Runs the delete public API operation.
Sourcepub fn resolve<T>(&self) -> Result<Arc<T>, HttpException>
pub fn resolve<T>(&self) -> Result<Arc<T>, HttpException>
Runs the resolve public API operation.
Sourcepub async fn shutdown(self) -> Result<(), HttpException>
pub async fn shutdown(self) -> Result<(), HttpException>
Run module on_shutdown hooks. Dropping without this skips shutdown hooks.
Auto Trait Implementations§
impl !RefUnwindSafe for TestApplication
impl !Send for TestApplication
impl !Sync for TestApplication
impl !UnwindSafe for TestApplication
impl Freeze for TestApplication
impl Unpin for TestApplication
impl UnsafeUnpin for TestApplication
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more