mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 11:50:23 +00:00
count calls to credential process
This commit is contained in:
parent
d464dbbb5e
commit
b6adac1a6b
|
@ -429,7 +429,7 @@ fn auth_token_optional(
|
|||
}
|
||||
};
|
||||
|
||||
if mutation.is_none() {
|
||||
if independent_of_endpoint || mutation.is_none() {
|
||||
cache.insert(
|
||||
url.clone(),
|
||||
CredentialCacheValue {
|
||||
|
@ -582,7 +582,7 @@ fn run_command(
|
|||
}
|
||||
}
|
||||
// todo: PASETO with process
|
||||
let independent_of_endpoint = false;
|
||||
let independent_of_endpoint = true;
|
||||
let action_str = match action {
|
||||
Action::Get => "get",
|
||||
Action::Store(_) => "store",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use cargo_test_support::registry::{Package, TestRegistry};
|
||||
use cargo_test_support::{basic_manifest, cargo_process, paths, project, registry, Project};
|
||||
use std::fs;
|
||||
use std::fs::{self, read_to_string};
|
||||
|
||||
fn toml_bin(proj: &Project, name: &str) -> String {
|
||||
proj.bin(name).display().to_string().replace('\\', "\\\\")
|
||||
|
@ -168,7 +168,22 @@ fn get_token_test() -> (Project, TestRegistry) {
|
|||
let cred_proj = project()
|
||||
.at("cred_proj")
|
||||
.file("Cargo.toml", &basic_manifest("test-cred", "1.0.0"))
|
||||
.file("src/main.rs", r#"fn main() { println!("sekrit"); } "#)
|
||||
.file(
|
||||
"src/main.rs",
|
||||
r#"
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
fn main() {
|
||||
let mut f = File::options()
|
||||
.write(true)
|
||||
.create(true)
|
||||
.append(true)
|
||||
.open("runs.log")
|
||||
.unwrap();
|
||||
write!(f, "+");
|
||||
println!("sekrit");
|
||||
} "#,
|
||||
)
|
||||
.build();
|
||||
cred_proj.cargo("build").run();
|
||||
|
||||
|
@ -219,6 +234,9 @@ fn publish() {
|
|||
",
|
||||
)
|
||||
.run();
|
||||
|
||||
let calls = read_to_string(p.root().join("runs.log")).unwrap().len();
|
||||
assert_eq!(calls, 1);
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
|
|
Loading…
Reference in a new issue