File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use std:: time:: Duration ;
2+
13use librespot_core:: authentication:: Credentials ;
24use librespot_core:: config:: SessionConfig ;
35use librespot_core:: session:: Session ;
46
7+ use tokio:: time:: timeout;
8+
59#[ tokio:: test]
610async fn test_connection ( ) {
7- let result = Session :: connect (
8- SessionConfig :: default ( ) ,
9- Credentials :: with_password ( "test" , "test" ) ,
10- None ,
11- )
12- . await ;
11+ timeout ( Duration :: from_secs ( 30 ) , async {
12+ let result = Session :: connect (
13+ SessionConfig :: default ( ) ,
14+ Credentials :: with_password ( "test" , "test" ) ,
15+ None ,
16+ )
17+ . await ;
1318
14- match result {
15- Ok ( _) => panic ! ( "Authentication succeeded despite of bad credentials." ) ,
16- Err ( e) => assert_eq ! ( e. to_string( ) , "Login failed with reason: Bad credentials" ) ,
17- } ;
19+ match result {
20+ Ok ( _) => panic ! ( "Authentication succeeded despite of bad credentials." ) ,
21+ Err ( e) => assert_eq ! ( e. to_string( ) , "Login failed with reason: Bad credentials" ) ,
22+ }
23+ } )
24+ . await
25+ . unwrap ( ) ;
1826}
You can’t perform that action at this time.
0 commit comments