Skip to content

Instantly share code, notes, and snippets.

@la10736
Created June 19, 2022 20:11
Show Gist options
  • Save la10736/d96fc4326fcc2c0c3d79d835983bec80 to your computer and use it in GitHub Desktop.
Save la10736/d96fc4326fcc2c0c3d79d835983bec80 to your computer and use it in GitHub Desktop.
Example use fixture from other module
fn main() {
println!("Hello, world!");
}
mod token;
use rstest::rstest;
use token::access_token;
#[rstest]
fn get_name(access_token: String) {
// get `name` by calling a web API that need to identify with access_token
assert_eq!("SOME_TOKEN", access_token)
}
use rstest::fixture;
#[fixture]
pub fn access_token() -> String {
// get `access_token` by calling a web API, e.g.
format!("SOME_TOKEN")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment