@@ -127,6 +127,30 @@ async fn invalid_manifest_missing_version() {
127127 assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"failed to parse `Cargo.toml` manifest file\n\nmissing field `version`"}]}"# ) ;
128128}
129129
130+ #[ tokio:: test( flavor = "multi_thread" ) ]
131+ async fn name_mismatch ( ) {
132+ let ( _app, _anon, _cookie, token) = TestApp :: full ( ) . with_token ( ) . await ;
133+
134+ let response =
135+ token. publish_crate ( PublishBuilder :: new ( "foo" , "1.0.0" ) . custom_manifest (
136+ "[package]\n name = \" bar\" \n version = \" 1.0.0\" \n description = \" description\" \n license = \" MIT\" \n " ,
137+ ) ) . await ;
138+ assert_eq ! ( response. status( ) , StatusCode :: BAD_REQUEST ) ;
139+ assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"metadata name `foo` does not match manifest name `bar`"}]}"# ) ;
140+ }
141+
142+ #[ tokio:: test( flavor = "multi_thread" ) ]
143+ async fn version_mismatch ( ) {
144+ let ( _app, _anon, _cookie, token) = TestApp :: full ( ) . with_token ( ) . await ;
145+
146+ let response =
147+ token. publish_crate ( PublishBuilder :: new ( "foo" , "1.0.0" ) . custom_manifest (
148+ "[package]\n name = \" foo\" \n version = \" 2.0.0\" \n description = \" description\" \n license = \" MIT\" \n " ,
149+ ) ) . await ;
150+ assert_eq ! ( response. status( ) , StatusCode :: BAD_REQUEST ) ;
151+ assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"metadata version `1.0.0` does not match manifest version `2.0.0`"}]}"# ) ;
152+ }
153+
130154#[ tokio:: test( flavor = "multi_thread" ) ]
131155async fn invalid_rust_version ( ) {
132156 let ( _app, _anon, _cookie, token) = TestApp :: full ( ) . with_token ( ) . await ;
0 commit comments