From 18723d19a54c2e76dcc6a0b84f72bf033cf8f84c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 22:29:31 +0000 Subject: [PATCH] Add error handling tests for dcaccount parameters Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com> --- src/qr/qr_tests.rs | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/qr/qr_tests.rs b/src/qr/qr_tests.rs index 9a67aba0e..7dca66049 100644 --- a/src/qr/qr_tests.rs +++ b/src/qr/qr_tests.rs @@ -840,6 +840,44 @@ async fn test_decode_account_with_custom_username() -> Result<()> { Ok(()) } +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_decode_account_with_params_missing_password() -> Result<()> { + // Test that missing password returns an error + let ctx = TestContext::new().await; + let result = check_qr( + &ctx.ctx, + "dcaccount:example.org?v=1&ih=imap.example.org", + ) + .await; + + assert!(result.is_err()); + assert!(result + .unwrap_err() + .to_string() + .contains("password missing")); + + Ok(()) +} + +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_decode_account_with_params_missing_version() -> Result<()> { + // Test that missing version returns an error + let ctx = TestContext::new().await; + let result = check_qr( + &ctx.ctx, + "dcaccount:example.org?p=secret&ih=imap.example.org", + ) + .await; + + assert!(result.is_err()); + assert!(result + .unwrap_err() + .to_string() + .contains("version missing")); + + Ok(()) +} + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_decode_tg_socks_proxy() -> Result<()> { let t = TestContext::new().await;