From e59456b96e439e3baccf157cd5481dcb87af920f Mon Sep 17 00:00:00 2001 From: Thomas Zahner Date: Wed, 11 Jun 2025 11:11:19 +0200 Subject: [PATCH] Add cli test --- lychee-bin/tests/cli.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lychee-bin/tests/cli.rs b/lychee-bin/tests/cli.rs index bf191e2..1119a60 100644 --- a/lychee-bin/tests/cli.rs +++ b/lychee-bin/tests/cli.rs @@ -1213,6 +1213,26 @@ mod cli { Ok(()) } + #[tokio::test] + async fn test_accept_overrides_defaults_not_additive() -> Result<()> { + let mock_server_200 = mock_server!(StatusCode::OK); + + let mut cmd = main_command(); + cmd.arg("--accept") + .arg("404") // ONLY accept 404 - should reject 200 as we overwrite the default + .arg("-") + .write_stdin(mock_server_200.uri()) + .assert() + .failure() + .code(2) + .stdout(contains(format!( + r#"[200] {}/ | Rejected status code (this depends on your "accept" configuration): OK"#, + mock_server_200.uri() + ))); + + Ok(()) + } + #[tokio::test] async fn test_skip_cache_unsupported() -> Result<()> { let base_path = fixtures_path().join("cache");