use dzlib_rs::{Client, objects::*, errors::ErrorKind}; use tokio_test::block_on; const EMAIL: &str = "email"; const PASSWORD: &str = "password"; #[test] fn check_access_token() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.get_token())?; let token = client.access_token.unwrap().token; println!("{}", token); assert_eq!(token.len(), 51); Ok(()) } #[test] fn check_track() -> Result<(), ErrorKind> { let mut client = Client::new(); let track = block_on(client.track(3135556))?; println!("{:#?}", track); Ok(()) } #[test] fn check_track_genres() -> Result<(), ErrorKind> { let mut client = Client::new(); let genres = block_on(Track::genres(&mut client, 3135556))?; println!("{:#?}", genres); Ok(()) } #[test] fn check_album() -> Result<(), ErrorKind> { let mut client = Client::new(); let album = block_on(client.album(302127))?; println!("{:#?}", album); Ok(()) } #[test] fn check_album_fans() -> Result<(), ErrorKind> { let mut client = Client::new(); let fans = block_on(Album::fans(&mut client, 302127))?; println!("{:#?}", fans); Ok(()) } #[test] fn check_album_tracks() -> Result<(), ErrorKind> { let mut client = Client::new(); let tracks = block_on(Album::tracks(&mut client, 302127))?; println!("{:#?}", tracks); Ok(()) } #[test] fn check_artist() -> Result<(), ErrorKind> { let mut client = Client::new(); let artist = block_on(client.artist(27))?; println!("{:#?}", artist); Ok(()) } #[test] fn check_artist_top() -> Result<(), ErrorKind> { let mut client = Client::new(); let top = block_on(Artist::top(&mut client, 27))?; println!("{:#?}", top); Ok(()) } #[test] fn check_artist_albums() -> Result<(), ErrorKind> { let mut client = Client::new(); let albums = block_on(Artist::fans(&mut client, 27))?; println!("{:#?}", albums); Ok(()) } #[test] fn check_artist_fans() -> Result<(), ErrorKind> { let mut client = Client::new(); let fans = block_on(Artist::fans(&mut client, 27))?; println!("{:#?}", fans); Ok(()) } #[test] fn check_artist_related() -> Result<(), ErrorKind> { let mut client = Client::new(); let related = block_on(Artist::related(&mut client, 27))?; println!("{:#?}", related); Ok(()) } #[test] fn check_artist_radio() -> Result<(), ErrorKind> { let mut client = Client::new(); let radio = block_on(Artist::radio(&mut client, 27))?; println!("{:#?}", radio); Ok(()) } #[test] fn check_artist_playlists() -> Result<(), ErrorKind> { let mut client = Client::new(); let playlists = block_on(Artist::playlists(&mut client, 27))?; println!("{:#?}", playlists); Ok(()) } #[test] fn check_playlist() -> Result<(), ErrorKind> { let mut client = Client::new(); let playlist = block_on(client.playlist(2021502402))?; println!("{:#?}", playlist); Ok(()) } #[test] fn check_playlist_fans() -> Result<(), ErrorKind> { let mut client = Client::new(); let playlist = block_on(Playlist::fans(&mut client, 2021502402))?; println!("{:#?}", playlist); Ok(()) } #[test] fn check_playlist_tracks() -> Result<(), ErrorKind> { let mut client = Client::new(); let tracks = block_on(Playlist::tracks(&mut client, 2021502402))?; println!("{:#?}", tracks); Ok(()) } #[test] fn check_playlist_seen() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let seen = block_on(Playlist::seen(&mut client, 2021502402))?; println!("{:#?}", seen); Ok(()) } #[test] fn check_user() -> Result<(), ErrorKind> { let mut client = Client::new(); let user = block_on(client.user(2741487522))?; println!("{:#?}", user); Ok(()) } #[test] fn check_user_self() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let user = block_on(client.user_self())?; println!("{:#?}", user); Ok(()) } #[test] fn check_user_albums() -> Result<(), ErrorKind> { let mut client = Client::new(); let albums = block_on(User::albums(&mut client, 5))?; println!("{:#?}", albums); Ok(()) } #[test] fn check_user_artists() -> Result<(), ErrorKind> { let mut client = Client::new(); let artists = block_on(User::artists(&mut client, 5))?; println!("{:#?}", artists); Ok(()) } #[test] fn check_user_tracks() -> Result<(), ErrorKind> { let mut client = Client::new(); let tracks = block_on(User::tracks(&mut client, 5))?; println!("{:#?}", tracks); Ok(()) } #[test] fn check_user_playlists() -> Result<(), ErrorKind> { let mut client = Client::new(); let playlists = block_on(User::playlists(&mut client, 5))?; println!("{:#?}", playlists); Ok(()) } #[test] fn check_user_personal_songs() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let songs = block_on(User::personal_songs(&mut client))?; println!("{:#?}", songs); Ok(()) } #[test] fn check_user_album_chart() -> Result<(), ErrorKind> { let mut client = Client::new(); let chart = block_on(User::album_chart(&mut client, 5))?; println!("{:#?}", chart); Ok(()) } #[test] fn check_user_artist_chart() -> Result<(), ErrorKind> { let mut client = Client::new(); let chart = block_on(User::artist_chart(&mut client, 5))?; println!("{:#?}", chart); Ok(()) } #[test] fn check_user_track_chart() -> Result<(), ErrorKind> { let mut client = Client::new(); let chart = block_on(User::track_chart(&mut client, 5))?; println!("{:#?}", chart); Ok(()) } #[test] fn check_user_playlist_chart() -> Result<(), ErrorKind> { let mut client = Client::new(); let chart = block_on(User::playlist_chart(&mut client, 5))?; println!("{:#?}", chart); Ok(()) } #[test] fn check_user_flow() -> Result<(), ErrorKind> { let mut client = Client::new(); let flow = block_on(User::flow(&mut client, 5))?; println!("{:#?}", flow); Ok(()) } #[test] fn check_user_history() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let history = block_on(User::history(&mut client))?; println!("{:#?}", history); Ok(()) } #[test] fn check_user_followings() -> Result<(), ErrorKind> { let mut client = Client::new(); let followings = block_on(User::followings(&mut client, 5))?; println!("{:#?}", followings); Ok(()) } #[test] fn check_user_followers() -> Result<(), ErrorKind> { let mut client = Client::new(); let followers = block_on(User::followers(&mut client, 5))?; println!("{:#?}", followers); Ok(()) } #[test] fn check_user_album_rec() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let rec = block_on(User::album_recommendations(&mut client))?; println!("{:#?}", rec); Ok(()) } #[test] fn check_user_release_rec() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let rec = block_on(User::release_recommendations(&mut client))?; println!("{:#?}", rec); Ok(()) } #[test] fn check_user_artist_rec() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let rec = block_on(User::artist_recommendations(&mut client))?; println!("{:#?}", rec); Ok(()) } #[test] fn check_user_playlist_rec() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let rec = block_on(User::playlist_recommendations(&mut client))?; println!("{:#?}", rec); Ok(()) } #[test] fn check_user_track_rec() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let rec = block_on(User::track_recommendations(&mut client))?; println!("{:#?}", rec); Ok(()) } #[test] fn check_user_radio_rec() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let rec = block_on(User::radio_recommendations(&mut client))?; println!("{:#?}", rec); Ok(()) } #[test] fn check_infos() -> Result<(), ErrorKind> { let mut client = Client::new(); let infos = block_on(client.infos())?; println!("{:#?}", infos); Ok(()) } #[test] fn check_genre() -> Result<(), ErrorKind> { let mut client = Client::new(); let genre = block_on(client.genre(0))?; println!("{:#?}", genre); Ok(()) } #[test] fn check_genre_artists() -> Result<(), ErrorKind> { let mut client = Client::new(); let artists = block_on(Genre::artists(&mut client, 0))?; println!("{:#?}", artists); Ok(()) } #[test] fn check_genre_radios() -> Result<(), ErrorKind> { let mut client = Client::new(); let radios = block_on(Genre::radios(&mut client, 0))?; println!("{:#?}", radios); Ok(()) } #[test] fn check_options() -> Result<(), ErrorKind> { let mut client = Client::new(); let options = block_on(client.options())?; println!("{:#?}", options); Ok(()) } #[test] fn check_editorial() -> Result<(), ErrorKind> { let mut client = Client::new(); let editorial = block_on(client.editorial(0))?; println!("{:#?}", editorial); Ok(()) } #[test] fn check_editorial_list() -> Result<(), ErrorKind> { let mut client = Client::new(); let list = block_on(Editorial::list(&mut client))?; println!("{:#?}", list); Ok(()) } #[test] fn check_editorial_selection() -> Result<(), ErrorKind> { let mut client = Client::new(); let selection = block_on(Editorial::selection(&mut client, 0))?; println!("{:#?}", selection); Ok(()) } #[test] fn check_editorial_charts() -> Result<(), ErrorKind> { let mut client = Client::new(); let charts = block_on(Editorial::charts(&mut client, 0))?; println!("{:#?}", charts); Ok(()) } #[test] fn check_lyrics() -> Result<(), ErrorKind> { let mut client = Client::new(); let lyrics = block_on(client.lyrics(2780622))?; println!("{:#?}", lyrics); Ok(()) } #[test] fn check_radio() -> Result<(), ErrorKind> { let mut client = Client::new(); let radio = block_on(client.radio(6))?; println!("{:#?}", radio); Ok(()) } #[test] fn check_radio_list() -> Result<(), ErrorKind> { let mut client = Client::new(); let radio_list = block_on(client.radio_list())?; println!("{:#?}", radio_list); Ok(()) } #[test] fn check_radio_genres() -> Result<(), ErrorKind> { let mut client = Client::new(); let genres = block_on(Radio::genres(&mut client))?; println!("{:#?}", genres); Ok(()) } #[test] fn check_chart() -> Result<(), ErrorKind> { let mut client = Client::new(); let chart = block_on(client.chart(0))?; println!("{:#?}", chart); Ok(()) } #[test] fn check_chart_tracks() -> Result<(), ErrorKind> { let mut client = Client::new(); let tracks = block_on(Chart::tracks(&mut client, 0))?; println!("{:#?}", tracks); Ok(()) } #[test] fn check_chart_albums() -> Result<(), ErrorKind> { let mut client = Client::new(); let albums = block_on(Chart::albums(&mut client, 0))?; println!("{:#?}", albums); Ok(()) } #[test] fn check_chart_artists() -> Result<(), ErrorKind> { let mut client = Client::new(); let artists = block_on(Chart::artists(&mut client, 0))?; println!("{:#?}", artists); Ok(()) } #[test] fn check_chart_playlists() -> Result<(), ErrorKind> { let mut client = Client::new(); let playlists = block_on(Chart::playlists(&mut client, 0))?; println!("{:#?}", playlists); Ok(()) } #[test] fn check_chart_podcasts() -> Result<(), ErrorKind> { let mut client = Client::new(); let playlists = block_on(Chart::podcasts(&mut client, 0))?; println!("{:#?}", playlists); Ok(()) } #[test] fn check_search_track() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(client.search_track("eminem"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_album() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(client.search_album("eminem"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_artist() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(client.search_artist("eminem"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_playlist() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(client.search_playlist("eminem"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_podcast() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(search::podcast(&mut client, "eminem"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_radio() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(search::radio(&mut client, "classic"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_user() -> Result<(), ErrorKind> { let mut client = Client::new(); let search = block_on(search::user(&mut client, "eminem"))?; println!("{:#?}", search); Ok(()) } #[test] fn check_search_history() -> Result<(), ErrorKind> { let mut client = Client::new(); block_on(client.login(EMAIL, PASSWORD))?; let search = block_on(search::history(&mut client))?; println!("{:#?}", search); Ok(()) } #[test] fn check_podcast() -> Result<(), ErrorKind> { let mut client = Client::new(); let podcast = block_on(client.podcast(2027))?; println!("{:#?}", podcast); Ok(()) } #[test] fn check_podcast_episodes() -> Result<(), ErrorKind> { let mut client = Client::new(); let episodes = block_on(Podcast::episodes(&mut client, 2027))?; println!("{:#?}", episodes); Ok(()) } #[test] fn check_episode() -> Result<(), ErrorKind> { let mut client = Client::new(); let episode = block_on(client.episode(56469))?; println!("{:#?}", episode); Ok(()) } #[test] fn check_register() -> Result<(), ErrorKind> { let mut client = Client::new(); let user_id = block_on(auth::register(&mut client, "email", "password", "name", "0000-00-00", "M"))?; println!("{:#?}", user_id); Ok(()) }