@@ -134,6 +134,97 @@ fn environment_token_with_asymmetric() {
134
134
. run ( ) ;
135
135
}
136
136
137
+ #[ cargo_test]
138
+ fn warn_both_asymmetric_and_token ( ) {
139
+ let _server = RegistryBuilder :: new ( )
140
+ . alternative ( )
141
+ . no_configure_token ( )
142
+ . build ( ) ;
143
+ let p = project ( )
144
+ . file (
145
+ ".cargo/config" ,
146
+ r#"
147
+ [registries.alternative]
148
+ token = "sekrit"
149
+ secret-key = "k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36"
150
+ "# ,
151
+ )
152
+ . file (
153
+ "Cargo.toml" ,
154
+ r#"
155
+ [package]
156
+ name = "foo"
157
+ version = "0.1.0"
158
+ description = "foo"
159
+ authors = []
160
+ license = "MIT"
161
+ homepage = "https://example.com/"
162
+ "# ,
163
+ )
164
+ . file ( "src/lib.rs" , "" )
165
+ . build ( ) ;
166
+
167
+ p. cargo ( "publish --no-verify --registry alternative" )
168
+ . masquerade_as_nightly_cargo ( & [ "credential-process" , "sparse-registry" , "registry-auth" ] )
169
+ . arg ( "-Zsparse-registry" )
170
+ . arg ( "-Zregistry-auth" )
171
+ . with_status ( 101 )
172
+ . with_stderr (
173
+ "\
174
+ [UPDATING] [..]
175
+ [ERROR] both `token` and `secret-key` were specified in the config for registry `alternative`.
176
+ Only one of these values may be set, remove one or the other to proceed.
177
+ " ,
178
+ )
179
+ . run ( ) ;
180
+ }
181
+
182
+ #[ cargo_test]
183
+ fn warn_both_asymmetric_and_credential_process ( ) {
184
+ let _server = RegistryBuilder :: new ( )
185
+ . alternative ( )
186
+ . no_configure_token ( )
187
+ . build ( ) ;
188
+ let p = project ( )
189
+ . file (
190
+ ".cargo/config" ,
191
+ r#"
192
+ [registries.alternative]
193
+ credential-process = "false"
194
+ secret-key = "k3.secret.fNYVuMvBgOlljt9TDohnaYLblghqaHoQquVZwgR6X12cBFHZLFsaU3q7X3k1Zn36"
195
+ "# ,
196
+ )
197
+ . file (
198
+ "Cargo.toml" ,
199
+ r#"
200
+ [package]
201
+ name = "foo"
202
+ version = "0.1.0"
203
+ description = "foo"
204
+ authors = []
205
+ license = "MIT"
206
+ homepage = "https://example.com/"
207
+ "# ,
208
+ )
209
+ . file ( "src/lib.rs" , "" )
210
+ . build ( ) ;
211
+
212
+ p. cargo ( "publish --no-verify --registry alternative" )
213
+ . masquerade_as_nightly_cargo ( & [ "credential-process" , "sparse-registry" , "registry-auth" ] )
214
+ . arg ( "-Zcredential-process" )
215
+ . arg ( "-Zsparse-registry" )
216
+ . arg ( "-Zregistry-auth" )
217
+ . with_status ( 101 )
218
+ . with_stderr (
219
+ "\
220
+ [UPDATING] [..]
221
+ [ERROR] both `credential-process` and `secret-key` were specified in the config for registry `alternative`.
222
+ Only one of these values may be set, remove one or the other to proceed.
223
+ " ,
224
+ )
225
+ . run ( ) ;
226
+ }
227
+
137
228
#[ cargo_test]
138
229
fn bad_environment_token_with_asymmetric_subject ( ) {
139
230
let registry = RegistryBuilder :: new ( )
0 commit comments