11//! Tests for the `cargo logout` command.
22
3- #![ allow( deprecated) ]
4-
53use super :: login:: check_token;
64use cargo_test_support:: paths:: { self , CargoPathExt } ;
75use cargo_test_support:: registry:: TestRegistry ;
8- use cargo_test_support:: { cargo_process, registry} ;
6+ use cargo_test_support:: { cargo_process, registry, str } ;
97
108fn simple_logout_test ( registry : & TestRegistry , reg : Option < & str > , flag : & str , note : & str ) {
119 let msg = reg. unwrap_or ( "crates-io" ) ;
@@ -15,11 +13,11 @@ fn simple_logout_test(registry: &TestRegistry, reg: Option<&str>, flag: &str, no
1513 cargo. replace_crates_io ( registry. index_url ( ) ) ;
1614 }
1715 cargo
18- . with_stderr ( & format ! (
16+ . with_stderr_data ( & format ! (
1917 "\
2018 [LOGOUT] token for `{msg}` has been removed from local storage
21- [NOTE] This does not revoke the token on the registry server.\n \
22- If you need to revoke the token, visit {note} and follow the instructions there.
19+ [NOTE] This does not revoke the token on the registry server.
20+ If you need to revoke the token, visit {note} and follow the instructions there.
2321"
2422 ) )
2523 . run ( ) ;
@@ -30,7 +28,11 @@ If you need to revoke the token, visit {note} and follow the instructions there.
3028 cargo. replace_crates_io ( registry. index_url ( ) ) ;
3129 }
3230 cargo
33- . with_stderr ( & format ! ( "[LOGOUT] not currently logged in to `{msg}`" ) )
31+ . with_stderr_data ( & format ! (
32+ "\
33+ [LOGOUT] not currently logged in to `{msg}`
34+ "
35+ ) )
3436 . run ( ) ;
3537 check_token ( None , reg) ;
3638}
@@ -85,21 +87,20 @@ fn default_registry_configured() {
8587 check_token ( Some ( "dummy-token" ) , Some ( "dummy-registry" ) ) ;
8688 check_token ( Some ( "crates-io-token" ) , None ) ;
8789
88- cargo_process ( "logout" )
89- . with_stderr (
90- "\
90+ cargo_process ( "logout" ) . with_stderr_data ( str![ [ r#"
9191[LOGOUT] token for `dummy-registry` has been removed from local storage
9292[NOTE] This does not revoke the token on the registry server.
93- If you need to revoke the token, visit the `dummy-registry` website \
94- and follow the instructions there.
95- " ,
96- )
97- . run ( ) ;
93+ If you need to revoke the token, visit the `dummy-registry` website and follow the instructions there.
94+
95+ "# ] ] ) . run ( ) ;
9896 check_token ( None , Some ( "dummy-registry" ) ) ;
9997 check_token ( Some ( "crates-io-token" ) , None ) ;
10098
10199 cargo_process ( "logout" )
102- . with_stderr ( "[LOGOUT] not currently logged in to `dummy-registry`" )
100+ . with_stderr_data ( str![ [ r#"
101+ [LOGOUT] not currently logged in to `dummy-registry`
102+
103+ "# ] ] )
103104 . run ( ) ;
104105}
105106
@@ -111,11 +112,17 @@ fn logout_asymmetric() {
111112
112113 cargo_process ( "logout --registry crates-io -Zasymmetric-token" )
113114 . masquerade_as_nightly_cargo ( & [ "asymmetric-token" ] )
114- . with_stderr ( "[LOGOUT] secret-key for `crates-io` has been removed from local storage" )
115+ . with_stderr_data ( str![ [ r#"
116+ [LOGOUT] secret-key for `crates-io` has been removed from local storage
117+
118+ "# ] ] )
115119 . run ( ) ;
116120
117121 cargo_process ( "logout --registry crates-io -Zasymmetric-token" )
118122 . masquerade_as_nightly_cargo ( & [ "asymmetric-token" ] )
119- . with_stderr ( "[LOGOUT] not currently logged in to `crates-io`" )
123+ . with_stderr_data ( str![ [ r#"
124+ [LOGOUT] not currently logged in to `crates-io`
125+
126+ "# ] ] )
120127 . run ( ) ;
121128}
0 commit comments