diff options
Diffstat (limited to 'tests/auth_file.rs')
-rw-r--r-- | tests/auth_file.rs | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/tests/auth_file.rs b/tests/auth_file.rs index eb40d2c..5632d46 100644 --- a/tests/auth_file.rs +++ b/tests/auth_file.rs @@ -4,22 +4,17 @@ use select::{document::Document, predicate::Text}; mod fixtures; -use crate::fixtures::{server, Error, FILES}; +use crate::fixtures::{server, Error, TestServer, FILES}; -#[rstest( - cli_auth_file_arg, - client_username, - client_password, - case("tests/data/auth1.txt", "joe", "123"), - case("tests/data/auth1.txt", "bob", "123"), - case("tests/data/auth1.txt", "bill", "") -)] +#[rstest] +#[case("joe", "123")] +#[case("bob", "123")] +#[case("bill", "")] fn auth_file_accepts( - cli_auth_file_arg: &str, - client_username: &str, - client_password: &str, + #[with(&["--auth-file", "tests/data/auth1.txt"])] server: TestServer, + #[case] client_username: &str, + #[case] client_password: &str, ) -> Result<(), Error> { - let server = server(&["--auth-file", cli_auth_file_arg]); let client = Client::new(); let response = client .get(server.url()) @@ -38,20 +33,15 @@ fn auth_file_accepts( Ok(()) } -#[rstest( - cli_auth_file_arg, - client_username, - client_password, - case("tests/data/auth1.txt", "joe", "wrongpassword"), - case("tests/data/auth1.txt", "bob", ""), - case("tests/data/auth1.txt", "nonexistentuser", "wrongpassword") -)] +#[rstest] +#[case("joe", "wrongpassword")] +#[case("bob", "")] +#[case("nonexistentuser", "wrongpassword")] fn auth_file_rejects( - cli_auth_file_arg: &str, - client_username: &str, - client_password: &str, + #[with(&["--auth-file", "tests/data/auth1.txt"])] server: TestServer, + #[case] client_username: &str, + #[case] client_password: &str, ) -> Result<(), Error> { - let server = server(&["--auth-file", cli_auth_file_arg]); let client = Client::new(); let status = client .get(server.url()) |