download.rs CLI wrapper has two behaviors worth testing: 1. Refuses to overwrite existing output file (bail with helpful message) 2. Defaults output path to the original filename from the record
These don't need MockTransport — they're filesystem-level checks. Use tempfile crate.
Test cases:
output_defaults_to_original_filename: mock the core call somehow, verify PathBuf logic
refuses_to_overwrite_existing_file: create a file, verify bail message includes the path
Note: testing these in isolation requires either extracting the file-write logic into a testable function or accepting that we test via the full Execute trait (which needs session/identity). Consider extracting a write_output(name, plaintext, output_override) -> Result<PathBuf> helper.
download.rs CLI wrapper has two behaviors worth testing: 1. Refuses to overwrite existing output file (bail with helpful message) 2. Defaults output path to the original filename from the record
These don't need MockTransport — they're filesystem-level checks. Use tempfile crate.
Test cases:
Note: testing these in isolation requires either extracting the file-write logic into a testable function or accepting that we test via the full Execute trait (which needs session/identity). Consider extracting a write_output(name, plaintext, output_override) -> Result<PathBuf> helper.