@@ -958,6 +958,53 @@ fn yank_max_version() {
958
958
assert_eq ! ( json. krate. max_version. unwrap( ) , "2.0.0" ) ;
959
959
}
960
960
961
+ #[ test]
962
+ fn publish_after_yank_max_version ( ) {
963
+ #[ derive( RustcDecodable ) ]
964
+ struct O {
965
+ ok : bool ,
966
+ }
967
+ let ( _b, app, middle) = :: app ( ) ;
968
+
969
+ // Upload a new crate
970
+ let mut req = :: new_req ( app, "fyk_max" , "1.0.0" ) ;
971
+ :: mock_user ( & mut req, :: user ( "foo" ) ) ;
972
+ let mut response = ok_resp ! ( middle. call( & mut req) ) ;
973
+
974
+ // double check the max version
975
+ let json: GoodCrate = :: json ( & mut response) ;
976
+ assert ! ( json. krate. max_version. is_some( ) ) ;
977
+ assert_eq ! ( json. krate. max_version. unwrap( ) , "1.0.0" ) ;
978
+
979
+ // yank version 1.0.0
980
+ let mut r = ok_resp ! ( middle. call( req. with_method( Method :: Delete )
981
+ . with_path( "/api/v1/crates/fyk_max/1.0.0/yank" ) ) ) ;
982
+ assert ! ( :: json:: <O >( & mut r) . ok) ;
983
+ let mut response = ok_resp ! ( middle. call( req. with_method( Method :: Get )
984
+ . with_path( "/api/v1/crates/fyk_max" ) ) ) ;
985
+ let json: CrateResponse = :: json ( & mut response) ;
986
+ assert ! ( json. krate. max_version. is_none( ) ) ;
987
+
988
+ // add version 2.0.0
989
+ let body = :: new_req_body_version_2 ( :: krate ( "fyk_max" ) ) ;
990
+ let mut response = ok_resp ! ( middle. call( req. with_path( "/api/v1/crates/new" )
991
+ . with_method( Method :: Put )
992
+ . with_body( & body) ) ) ;
993
+ let json: GoodCrate = :: json ( & mut response) ;
994
+ assert ! ( json. krate. max_version. is_some( ) ) ;
995
+ assert_eq ! ( json. krate. max_version. unwrap( ) , "2.0.0" ) ;
996
+
997
+ // unyank version 1.0.0
998
+ let mut r = ok_resp ! ( middle. call( req. with_method( Method :: Put )
999
+ . with_path( "/api/v1/crates/fyk_max/1.0.0/unyank" ) ) ) ;
1000
+ assert ! ( :: json:: <O >( & mut r) . ok) ;
1001
+ let mut response = ok_resp ! ( middle. call( req. with_method( Method :: Get )
1002
+ . with_path( "/api/v1/crates/fyk_max" ) ) ) ;
1003
+ let json: CrateResponse = :: json ( & mut response) ;
1004
+ assert ! ( json. krate. max_version. is_some( ) ) ;
1005
+ assert_eq ! ( json. krate. max_version. unwrap( ) , "2.0.0" ) ;
1006
+ }
1007
+
961
1008
#[ test]
962
1009
fn bad_keywords ( ) {
963
1010
let ( _b, app, middle) = :: app ( ) ;
0 commit comments