pub struct Stubr { /* private fields */ }
Expand description
Allows running a Wiremock mock server from Wiremock stubs. Delegates runtime to wiremock-rs.
Implementations§
source§impl Stubr
impl Stubr
Fallible API
sourcepub async fn try_start<T>(stubs: T) -> StubrResult<Self>where
T: Into<AnyStubs>,
pub async fn try_start<T>(stubs: T) -> StubrResult<Self>where T: Into<AnyStubs>,
Runs a mock server. The server is unbinded when the instance is dropped. Use this in a test context.
stubs
- folder or file containing the stubs
sourcepub async fn try_start_with<T>(stubs: T, config: Config) -> StubrResult<Self>where
T: Into<AnyStubs>,
pub async fn try_start_with<T>(stubs: T, config: Config) -> StubrResult<Self>where T: Into<AnyStubs>,
Runs a mock server with some configuration. The server is unbinded when the instance is dropped. Use this in a test context.
stubs
- folder or file containing the stubsconfig
- global server configuration
sourcepub fn try_start_blocking<T>(stubs: T) -> StubrResult<Self>where
T: Into<AnyStubs>,
pub fn try_start_blocking<T>(stubs: T) -> StubrResult<Self>where T: Into<AnyStubs>,
Runs a mock server in a blocking way. The server is unbinded when the instance is dropped. Use this in a test context.
stubs
- folder or file containing the stubs
sourcepub fn try_start_blocking_with<T>(stubs: T, config: Config) -> StubrResult<Self>where
T: Into<AnyStubs>,
pub fn try_start_blocking_with<T>(stubs: T, config: Config) -> StubrResult<Self>where T: Into<AnyStubs>,
Runs a mock server in a blocking way with some configuration. The server is unbinded when the instance is dropped. Use this in a test context.
stubs
- folder or file containing the stubsconfig
- global server configuration
sourcepub async fn try_app(name: &str) -> StubrResult<Self>
pub async fn try_app(name: &str) -> StubrResult<Self>
Runs stubs of a remote producer app.
name
- producer name
sourcepub async fn try_app_with(name: &str, config: Config) -> StubrResult<Self>
pub async fn try_app_with(name: &str, config: Config) -> StubrResult<Self>
Runs stubs of a remote producer app.
name
- producer name
sourcepub fn try_app_blocking(name: &str) -> StubrResult<Self>
pub fn try_app_blocking(name: &str) -> StubrResult<Self>
Runs stubs of a remote producer app.
name
- producer name
sourcepub fn try_app_blocking_with(name: &str, config: Config) -> StubrResult<Self>
pub fn try_app_blocking_with(name: &str, config: Config) -> StubrResult<Self>
Runs stubs of a remote producer app.
name
- producer name
pub async fn try_apps(names: &[&str]) -> StubrResult<Vec<Self>>
pub async fn try_apps_with( names: &[&str], config: Config ) -> StubrResult<Vec<Self>>
pub fn try_apps_blocking(names: &[&str]) -> StubrResult<Vec<Self>>
pub fn try_apps_blocking_with( names: &[&str], config: Config ) -> StubrResult<Vec<Self>>
source§impl Stubr
impl Stubr
Infallible API
sourcepub async fn start<T>(stubs: T) -> Selfwhere
T: Into<AnyStubs>,
pub async fn start<T>(stubs: T) -> Selfwhere T: Into<AnyStubs>,
see Stubr::try_start
sourcepub fn start_blocking<T>(stubs: T) -> Selfwhere
T: Into<AnyStubs>,
pub fn start_blocking<T>(stubs: T) -> Selfwhere T: Into<AnyStubs>,
sourcepub async fn start_with<T>(stubs: T, config: Config) -> Selfwhere
T: Into<AnyStubs>,
pub async fn start_with<T>(stubs: T, config: Config) -> Selfwhere T: Into<AnyStubs>,
sourcepub fn start_blocking_with<T>(stubs: T, config: Config) -> Selfwhere
T: Into<AnyStubs>,
pub fn start_blocking_with<T>(stubs: T, config: Config) -> Selfwhere T: Into<AnyStubs>,
sourcepub async fn app(name: &str) -> Self
pub async fn app(name: &str) -> Self
see Stubr::try_app
sourcepub fn app_blocking(name: &str) -> Self
pub fn app_blocking(name: &str) -> Self
sourcepub fn app_blocking_with(name: &str, config: Config) -> Self
pub fn app_blocking_with(name: &str, config: Config) -> Self
sourcepub async fn apps(names: &[&str]) -> Vec<Self>
pub async fn apps(names: &[&str]) -> Vec<Self>
see Stubr::try_apps