show buggy behavior of not trimming newlines in new credential process test

This commit is contained in:
Arlo Siemsen 2024-04-17 12:11:03 -05:00
parent 852a31615d
commit a498391686
1 changed files with 19 additions and 0 deletions

View File

@ -695,3 +695,22 @@ fn alias_builtin_warning() {
)
.run();
}
#[cargo_test]
fn login_token_from_stdin() {
// Test reading a token from stdin, ensuring newlines are trimmed.
let registry = registry::RegistryBuilder::new()
.no_configure_token()
.credential_provider(&[&build_provider("test-cred", r#"{"Ok": {"kind": "login"}}"#)])
.build();
cargo_process("login")
.replace_crates_io(registry.index_url())
.with_stdin("abcdefg\n")
.with_stderr(
r#"[UPDATING] [..]
{"v":1,"registry":{"index-url":"https://github.com/rust-lang/crates.io-index","name":"crates-io"},"kind":"login","token":"abcdefg\n","login-url":"[..]"}
"#,
)
.run();
}