1
1
//! Tests for the `cargo logout` command.
2
2
3
- #![ allow( deprecated) ]
4
-
5
3
use super :: login:: check_token;
6
4
use cargo_test_support:: paths:: { self , CargoPathExt } ;
7
5
use cargo_test_support:: registry:: TestRegistry ;
8
- use cargo_test_support:: { cargo_process, registry} ;
6
+ use cargo_test_support:: { cargo_process, registry, str } ;
9
7
10
8
fn simple_logout_test ( registry : & TestRegistry , reg : Option < & str > , flag : & str , note : & str ) {
11
9
let msg = reg. unwrap_or ( "crates-io" ) ;
@@ -15,11 +13,11 @@ fn simple_logout_test(registry: &TestRegistry, reg: Option<&str>, flag: &str, no
15
13
cargo. replace_crates_io ( registry. index_url ( ) ) ;
16
14
}
17
15
cargo
18
- . with_stderr ( & format ! (
16
+ . with_stderr_data ( & format ! (
19
17
"\
20
18
[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.
23
21
"
24
22
) )
25
23
. run ( ) ;
@@ -30,7 +28,11 @@ If you need to revoke the token, visit {note} and follow the instructions there.
30
28
cargo. replace_crates_io ( registry. index_url ( ) ) ;
31
29
}
32
30
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
+ ) )
34
36
. run ( ) ;
35
37
check_token ( None , reg) ;
36
38
}
@@ -85,21 +87,20 @@ fn default_registry_configured() {
85
87
check_token ( Some ( "dummy-token" ) , Some ( "dummy-registry" ) ) ;
86
88
check_token ( Some ( "crates-io-token" ) , None ) ;
87
89
88
- cargo_process ( "logout" )
89
- . with_stderr (
90
- "\
90
+ cargo_process ( "logout" ) . with_stderr_data ( str![ [ r#"
91
91
[LOGOUT] token for `dummy-registry` has been removed from local storage
92
92
[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 ( ) ;
98
96
check_token ( None , Some ( "dummy-registry" ) ) ;
99
97
check_token ( Some ( "crates-io-token" ) , None ) ;
100
98
101
99
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
+ "# ] ] )
103
104
. run ( ) ;
104
105
}
105
106
@@ -111,11 +112,17 @@ fn logout_asymmetric() {
111
112
112
113
cargo_process ( "logout --registry crates-io -Zasymmetric-token" )
113
114
. 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
+ "# ] ] )
115
119
. run ( ) ;
116
120
117
121
cargo_process ( "logout --registry crates-io -Zasymmetric-token" )
118
122
. 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
+ "# ] ] )
120
127
. run ( ) ;
121
128
}
0 commit comments