File tree 1 file changed +36
-0
lines changed 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -977,3 +977,39 @@ fn publish_with_patch() {
977
977
& [ "Cargo.toml" , "Cargo.toml.orig" , "src/main.rs" ] ,
978
978
) ;
979
979
}
980
+
981
+ #[ test]
982
+ fn publish_checks_for_token_before_verify ( ) {
983
+ registry:: init ( ) ;
984
+
985
+ let p = project ( )
986
+ . file (
987
+ "Cargo.toml" ,
988
+ r#"
989
+ [project]
990
+ name = "foo"
991
+ version = "0.0.1"
992
+ authors = []
993
+ license = "MIT"
994
+ description = "foo"
995
+ "# ,
996
+ )
997
+ . file ( "src/main.rs" , "fn main() {}" )
998
+ . build ( ) ;
999
+
1000
+ let credentials = paths:: home ( ) . join ( ".cargo/credentials" ) ;
1001
+ fs:: remove_file ( & credentials) . unwrap ( ) ;
1002
+
1003
+ // Assert upload token error before the package is verified
1004
+ p. cargo ( "publish" )
1005
+ . with_status ( 101 )
1006
+ . with_stderr_contains ( "[ERROR] no upload token found, please run `cargo login`" )
1007
+ . with_stderr_does_not_contain ( "[VERIFYING] foo v0.0.1 ([CWD])" )
1008
+ . run ( ) ;
1009
+
1010
+ // Assert package verified successfully on dry run
1011
+ p. cargo ( "publish --dry-run" )
1012
+ . with_status ( 0 )
1013
+ . with_stderr_contains ( "[VERIFYING] foo v0.0.1 ([CWD])" )
1014
+ . run ( ) ;
1015
+ }
You can’t perform that action at this time.
0 commit comments