2021-04-14 17:32:15 +00:00
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
use tokio::time::timeout;
|
|
|
|
|
2022-01-16 00:36:28 +00:00
|
|
|
use librespot_core::{authentication::Credentials, config::SessionConfig, session::Session};
|
|
|
|
|
2021-04-02 12:44:42 +00:00
|
|
|
#[tokio::test]
|
|
|
|
async fn test_connection() {
|
2021-04-14 17:32:15 +00:00
|
|
|
timeout(Duration::from_secs(30), async {
|
2022-01-16 00:36:28 +00:00
|
|
|
let result = Session::new(SessionConfig::default(), None)
|
|
|
|
.connect(Credentials::with_password("test", "test"))
|
|
|
|
.await;
|
2021-01-21 20:56:23 +00:00
|
|
|
|
2021-04-14 17:32:15 +00:00
|
|
|
match result {
|
|
|
|
Ok(_) => panic!("Authentication succeeded despite of bad credentials."),
|
2021-12-26 22:51:25 +00:00
|
|
|
Err(e) => assert!(!e.to_string().is_empty()), // there should be some error message
|
2021-04-14 17:32:15 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.await
|
|
|
|
.unwrap();
|
2021-04-02 12:44:42 +00:00
|
|
|
}
|