From aed776ac49cb44705463d9e43c070dc56adaaae3 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Mon, 10 Jun 2024 00:38:45 +0200 Subject: Remove explicit dependency on http We now use the one supplied by actix-web. --- tests/auth_file.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auth_file.rs') diff --git a/tests/auth_file.rs b/tests/auth_file.rs index ddc9e25..372c695 100644 --- a/tests/auth_file.rs +++ b/tests/auth_file.rs @@ -1,7 +1,7 @@ mod fixtures; +use actix_web::http::StatusCode; use fixtures::{server, server_no_stderr, Error, FILES}; -use http::StatusCode; use reqwest::blocking::Client; use rstest::rstest; use select::document::Document; -- cgit v1.2.3 From ae37a5799385d9e9d0b3647e2b4520782cd02d26 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Mon, 10 Jun 2024 00:44:09 +0200 Subject: Bump reqwest to v0.12 --- tests/auth_file.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auth_file.rs') diff --git a/tests/auth_file.rs b/tests/auth_file.rs index 372c695..15af8f1 100644 --- a/tests/auth_file.rs +++ b/tests/auth_file.rs @@ -1,8 +1,8 @@ mod fixtures; -use actix_web::http::StatusCode; use fixtures::{server, server_no_stderr, Error, FILES}; use reqwest::blocking::Client; +use reqwest::StatusCode; use rstest::rstest; use select::document::Document; use select::predicate::Text; -- cgit v1.2.3 From 4dc634655edac54e9638e8390d89a96e235522c0 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Fri, 10 Jan 2025 17:23:00 +0100 Subject: Reorganize imports to be more consistent --- tests/auth_file.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'tests/auth_file.rs') diff --git a/tests/auth_file.rs b/tests/auth_file.rs index 15af8f1..10a94ed 100644 --- a/tests/auth_file.rs +++ b/tests/auth_file.rs @@ -1,11 +1,10 @@ +use reqwest::{blocking::Client, StatusCode}; +use rstest::rstest; +use select::{document::Document, predicate::Text}; + mod fixtures; -use fixtures::{server, server_no_stderr, Error, FILES}; -use reqwest::blocking::Client; -use reqwest::StatusCode; -use rstest::rstest; -use select::document::Document; -use select::predicate::Text; +use crate::fixtures::{server, server_no_stderr, Error, FILES}; #[rstest( cli_auth_file_arg, -- cgit v1.2.3 From f0eb61436e62d0d0d755ac8280bf97b4b52d4e0b Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Thu, 6 Feb 2025 04:30:28 +0100 Subject: Get rid of server_no_stderr We'll now always just pipe the contents of the child to the parent. --- tests/auth_file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/auth_file.rs') diff --git a/tests/auth_file.rs b/tests/auth_file.rs index 10a94ed..eb40d2c 100644 --- a/tests/auth_file.rs +++ b/tests/auth_file.rs @@ -4,7 +4,7 @@ use select::{document::Document, predicate::Text}; mod fixtures; -use crate::fixtures::{server, server_no_stderr, Error, FILES}; +use crate::fixtures::{server, Error, FILES}; #[rstest( cli_auth_file_arg, @@ -51,7 +51,7 @@ fn auth_file_rejects( client_username: &str, client_password: &str, ) -> Result<(), Error> { - let server = server_no_stderr(&["--auth-file", cli_auth_file_arg]); + let server = server(&["--auth-file", cli_auth_file_arg]); let client = Client::new(); let status = client .get(server.url()) -- cgit v1.2.3 From 57f02a1587555176f1b43b001e7846ac9eb2e949 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Thu, 6 Feb 2025 05:18:20 +0100 Subject: Clean up and modernize rstest usage We still had some old-style syntax in there. --- tests/auth_file.rs | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) (limited to 'tests/auth_file.rs') 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()) -- cgit v1.2.3