File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,57 @@ You may press ctrl-c to skip waiting; the crate should be available shortly.
130
130
validate_upload_foo ( ) ;
131
131
}
132
132
133
+ #[ cargo_test]
134
+ fn duplicate_version ( ) {
135
+ let registry_dupl = RegistryBuilder :: new ( )
136
+ . http_api ( )
137
+ . http_index ( )
138
+ . add_responder ( "/api/v1/crates/new" , move |_req, _server| Response {
139
+ code : 200 ,
140
+ headers : vec ! [ ] ,
141
+ body : br#"{"errors": [{"detail": "crate version `0.0.1` is already uploaded"}]}"#
142
+ . to_vec ( ) ,
143
+ } )
144
+ . build ( ) ;
145
+
146
+ let p = project ( )
147
+ . file (
148
+ "Cargo.toml" ,
149
+ r#"
150
+ [package]
151
+ name = "foo"
152
+ version = "0.0.1"
153
+ authors = []
154
+ license = "MIT"
155
+ description = "foo"
156
+ "# ,
157
+ )
158
+ . file ( "src/main.rs" , "fn main() {}" )
159
+ . build ( ) ;
160
+
161
+ p. cargo ( "publish" )
162
+ . replace_crates_io ( registry_dupl. index_url ( ) )
163
+ . with_stderr (
164
+ "\
165
+ [UPDATING] crates.io index
166
+ [WARNING] [..]
167
+ See [..]
168
+ [PACKAGING] foo v0.0.1 ([CWD])
169
+ [VERIFYING] foo v0.0.1 ([CWD])
170
+ [..]
171
+ [..]
172
+ [..]
173
+ [UPLOADING] foo v0.0.1 ([CWD])
174
+ error: failed to publish [..]
175
+
176
+ Caused by:
177
+ [..] is already uploaded
178
+ " ,
179
+ )
180
+ . with_status ( 101 )
181
+ . run ( ) ;
182
+ }
183
+
133
184
// Check that the `token` key works at the root instead of under a
134
185
// `[registry]` table.
135
186
#[ cargo_test]
You can’t perform that action at this time.
0 commit comments