Created
June 19, 2022 20:11
-
-
Save la10736/d96fc4326fcc2c0c3d79d835983bec80 to your computer and use it in GitHub Desktop.
Example use fixture from other module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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