summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/tests/testsuite/publish.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/cargo/tests/testsuite/publish.rs')
-rw-r--r--src/tools/cargo/tests/testsuite/publish.rs47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/tools/cargo/tests/testsuite/publish.rs b/src/tools/cargo/tests/testsuite/publish.rs
index 50ad697d5..67569bf3b 100644
--- a/src/tools/cargo/tests/testsuite/publish.rs
+++ b/src/tools/cargo/tests/testsuite/publish.rs
@@ -194,8 +194,8 @@ fn simple_publish_with_asymmetric() {
.file("src/main.rs", "fn main() {}")
.build();
- p.cargo("publish --no-verify -Zcredential-process --registry dummy-registry")
- .masquerade_as_nightly_cargo(&["credential-process"])
+ p.cargo("publish --no-verify -Zasymmetric-token --registry dummy-registry")
+ .masquerade_as_nightly_cargo(&["asymmetric-token"])
.with_stderr(
"\
[UPDATING] `dummy-registry` index
@@ -922,6 +922,48 @@ You may press ctrl-c [..]
}
#[cargo_test]
+fn publish_failed_with_index_and_only_allowed_registry() {
+ let registry = RegistryBuilder::new()
+ .http_api()
+ .http_index()
+ .alternative()
+ .build();
+
+ let p = project().build();
+
+ let _ = repo(&paths::root().join("foo"))
+ .file(
+ "Cargo.toml",
+ r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+ license = "MIT"
+ description = "foo"
+ documentation = "foo"
+ homepage = "foo"
+ repository = "foo"
+ publish = ["alternative"]
+ "#,
+ )
+ .file("src/main.rs", "fn main() {}")
+ .build();
+
+ p.cargo("publish")
+ .arg("--index")
+ .arg(registry.index_url().as_str())
+ .with_status(101)
+ .with_stderr(
+ "\
+[NOTE] Found `alternative` as only allowed registry. Publishing to it automatically.
+[ERROR] command-line argument --index requires --token to be specified
+",
+ )
+ .run();
+}
+
+#[cargo_test]
fn publish_fail_with_no_registry_specified() {
let p = project().build();
@@ -1923,6 +1965,7 @@ Caused by:
headers:
<tab>HTTP/1.1 400
<tab>Content-Length: 7
+ <tab>Connection: close
<tab>
body:
go away