Skip to content

Instantly share code, notes, and snippets.

@alexliesenfeld
Created March 24, 2024 07:27
Show Gist options
  • Save alexliesenfeld/8b6591fd39e1b85b987f0acb0adade71 to your computer and use it in GitHub Desktop.
Save alexliesenfeld/8b6591fd39e1b85b987f0acb0adade71 to your computer and use it in GitHub Desktop.
Cargo.toml
#[tokio::test]
async fn test_something_async() {
let server = httpmock::MockServer::start_async().await;
let mock = server.mock_async(|when, then| {
when.path("/v1/payment_intents");
then.status(200);
}).await;
let res = reqwest::get(server.url("/v1/payment_intents")).await.unwrap();
assert_eq!(res.status().as_u16(), 200);
mock.assert();
}
[package]
name = "stripetest"
version = "0.1.0"
edition = "2021"
[dev-dependencies]
httpmock = "0.7.0-rc.1"
reqwest = "0.11"
tokio = { version = "1", features = ["full"] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment