@@ -32,6 +32,7 @@ impl AsyncTestContext for MainContext {
32
32
if !test_host. is_empty ( ) {
33
33
zoo. set_base_url ( & test_host) ;
34
34
}
35
+ login ( test_host. clone ( ) , test_token. clone ( ) ) . await ;
35
36
36
37
Self {
37
38
test_host,
@@ -43,6 +44,28 @@ impl AsyncTestContext for MainContext {
43
44
async fn teardown ( self ) { }
44
45
}
45
46
47
+ async fn login ( test_host : String , test_token : String ) {
48
+ tokio:: task:: spawn_local ( async move {
49
+ run_test ( TestItem {
50
+ name : "login" . to_string ( ) ,
51
+ args : vec ! [
52
+ "zoo" . to_string( ) ,
53
+ "auth" . to_string( ) ,
54
+ "login" . to_string( ) ,
55
+ "--host" . to_string( ) ,
56
+ test_host. clone( ) ,
57
+ "--with-token" . to_string( ) ,
58
+ ] ,
59
+ stdin : Some ( test_token) ,
60
+ want_out : "✔ Logged in as " . to_string ( ) ,
61
+ want_err : "" . to_string ( ) ,
62
+ want_code : 0 ,
63
+ ..Default :: default ( )
64
+ } )
65
+ . await ;
66
+ } ) ;
67
+ }
68
+
46
69
#[ test_context( MainContext ) ]
47
70
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 3 ) ]
48
71
#[ serial_test:: serial]
@@ -202,29 +225,6 @@ async fn serial_test_version(_ctx: &mut MainContext) {
202
225
. await ;
203
226
}
204
227
205
- #[ test_context( MainContext ) ]
206
- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 3 ) ]
207
- #[ serial_test:: serial]
208
- async fn serial_test_login ( ctx : & mut MainContext ) {
209
- run_test ( TestItem {
210
- name : "login" . to_string ( ) ,
211
- args : vec ! [
212
- "zoo" . to_string( ) ,
213
- "auth" . to_string( ) ,
214
- "login" . to_string( ) ,
215
- "--host" . to_string( ) ,
216
- ctx. test_host. clone( ) ,
217
- "--with-token" . to_string( ) ,
218
- ] ,
219
- stdin : Some ( ctx. test_token . clone ( ) ) ,
220
- want_out : "✔ Logged in as " . to_string ( ) ,
221
- want_err : "" . to_string ( ) ,
222
- want_code : 0 ,
223
- ..Default :: default ( )
224
- } )
225
- . await ;
226
- }
227
-
228
228
#[ test_context( MainContext ) ]
229
229
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 3 ) ]
230
230
#[ serial_test:: serial]
0 commit comments