|
1 | 1 | //! Tests for the `cargo login` command.
|
2 | 2 |
|
3 | 3 | use cargo_test_support::install::cargo_home;
|
4 |
| -use cargo_test_support::registry::RegistryBuilder; |
| 4 | +use cargo_test_support::registry::{self, RegistryBuilder}; |
5 | 5 | use cargo_test_support::{cargo_process, t};
|
6 | 6 | use std::fs::{self};
|
7 | 7 | use std::path::PathBuf;
|
@@ -154,19 +154,25 @@ fn bad_asymmetric_token_args() {
|
154 | 154 | .run();
|
155 | 155 | }
|
156 | 156 |
|
157 |
| -// todo why do theas hang when run as a test? |
158 |
| -// #[cargo_test] |
159 |
| -// fn asymmetric_requires_nightly() { |
160 |
| -// cargo_process("login --key-subject=foo") |
161 |
| -// .with_status(101) |
162 |
| -// .with_stderr_contains("asymmetric token options are unstable and require the `-Z registry-auth` option on the nightly channel") |
163 |
| -// .run(); |
164 |
| -// cargo_process("login --generate-keypair") |
165 |
| -// .with_status(101) |
166 |
| -// .with_stderr_contains("asymmetric token options are unstable and require the `-Z registry-auth` option on the nightly channel") |
167 |
| -// .run(); |
168 |
| -// cargo_process("login --secret-key") |
169 |
| -// .with_status(101) |
170 |
| -// .with_stderr_contains("asymmetric token options are unstable and require the `-Z registry-auth` option on the nightly channel") |
171 |
| -// .run(); |
172 |
| -// } |
| 157 | +#[cargo_test] |
| 158 | +fn asymmetric_requires_nightly() { |
| 159 | + let registry = registry::init(); |
| 160 | + cargo_process("login --key-subject=foo") |
| 161 | + .replace_crates_io(registry.index_url()) |
| 162 | + .with_status(101) |
| 163 | + .with_stderr_contains("[ERROR] the `key-subject` flag is unstable, pass `-Z registry-auth` to enable it\n\ |
| 164 | + See https://github.com/rust-lang/cargo/issues/10519 for more information about the `key-subject` flag.") |
| 165 | + .run(); |
| 166 | + cargo_process("login --generate-keypair") |
| 167 | + .replace_crates_io(registry.index_url()) |
| 168 | + .with_status(101) |
| 169 | + .with_stderr_contains("[ERROR] the `generate-keypair` flag is unstable, pass `-Z registry-auth` to enable it\n\ |
| 170 | + See https://github.com/rust-lang/cargo/issues/10519 for more information about the `generate-keypair` flag.") |
| 171 | + .run(); |
| 172 | + cargo_process("login --secret-key") |
| 173 | + .replace_crates_io(registry.index_url()) |
| 174 | + .with_status(101) |
| 175 | + .with_stderr_contains("[ERROR] the `secret-key` flag is unstable, pass `-Z registry-auth` to enable it\n\ |
| 176 | + See https://github.com/rust-lang/cargo/issues/10519 for more information about the `secret-key` flag.") |
| 177 | + .run(); |
| 178 | +} |
0 commit comments