Big debug of pmoqobuz step 1
This commit is contained in:
@@ -67,7 +67,7 @@ impl QobuzApi {
|
||||
///
|
||||
/// * `QobuzError::Unauthorized` - Credentials invalides
|
||||
/// * `QobuzError::SubscriptionRequired` - Compte gratuit (non éligible)
|
||||
pub async fn login(&mut self, username: &str, password: &str) -> Result<AuthInfo> {
|
||||
pub async fn login(&self, username: &str, password: &str) -> Result<AuthInfo> {
|
||||
info!("Attempting to login to Qobuz as {}", username);
|
||||
|
||||
let params = [("username", username), ("password", password)];
|
||||
@@ -105,14 +105,13 @@ impl QobuzApi {
|
||||
|
||||
/// Vérifie si le client est authentifié
|
||||
pub fn is_authenticated(&self) -> bool {
|
||||
self.user_auth_token.is_some() && self.user_id.is_some()
|
||||
self.auth_token().is_some() && self.user_id().is_some()
|
||||
}
|
||||
|
||||
/// Déconnecte l'utilisateur
|
||||
pub fn logout(&mut self) {
|
||||
pub fn logout(&self) {
|
||||
debug!("Logging out");
|
||||
self.user_auth_token = None;
|
||||
self.user_id = None;
|
||||
self.clear_auth();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +121,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_is_authenticated() {
|
||||
let mut api = QobuzApi::new("test_app_id").unwrap();
|
||||
let api = QobuzApi::new("test_app_id").unwrap();
|
||||
assert!(!api.is_authenticated());
|
||||
|
||||
api.set_auth_token("token".to_string(), "user123".to_string());
|
||||
|
||||
Reference in New Issue
Block a user