mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
6c2491b9a3
This allows more control over how the credentials are saved to the cache
27 lines
717 B
Rust
27 lines
717 B
Rust
use std::time::Duration;
|
|
|
|
use librespot_core::authentication::Credentials;
|
|
use librespot_core::config::SessionConfig;
|
|
use librespot_core::session::Session;
|
|
|
|
use tokio::time::timeout;
|
|
|
|
#[tokio::test]
|
|
async fn test_connection() {
|
|
timeout(Duration::from_secs(30), async {
|
|
let result = Session::connect(
|
|
SessionConfig::default(),
|
|
Credentials::with_password("test", "test"),
|
|
None,
|
|
false,
|
|
)
|
|
.await;
|
|
|
|
match result {
|
|
Ok(_) => panic!("Authentication succeeded despite of bad credentials."),
|
|
Err(e) => assert_eq!(e.to_string(), "Login failed with reason: Bad credentials"),
|
|
}
|
|
})
|
|
.await
|
|
.unwrap();
|
|
}
|