2019-11-10 03:11:43 +09:00
|
|
|
from yandex_music import GeneratedPlaylist
|
|
|
|
|
|
|
|
|
|
|
|
class TestGeneratedPlaylist:
|
|
|
|
type = 'playlistOfTheDay'
|
|
|
|
ready = True
|
|
|
|
notify = False
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
description = []
|
2019-11-10 03:11:43 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, generated_playlist, playlist):
|
|
|
|
assert generated_playlist.type == self.type
|
|
|
|
assert generated_playlist.ready == self.ready
|
|
|
|
assert generated_playlist.notify == self.notify
|
|
|
|
assert generated_playlist.data == playlist
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
assert generated_playlist.description == self.description
|
2019-11-10 03:11:43 +09:00
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert GeneratedPlaylist.de_json({}, client) is None
|
|
|
|
|
2019-12-29 17:06:27 +09:00
|
|
|
def test_de_list_none(self, client):
|
|
|
|
assert GeneratedPlaylist.de_list({}, client) == []
|
|
|
|
|
2019-11-10 03:11:43 +09:00
|
|
|
def test_de_json_required(self, client, playlist):
|
2019-12-27 05:27:58 +09:00
|
|
|
json_dict = {'type_': self.type, 'ready': self.ready, 'notify': self.notify, 'data': playlist.to_dict()}
|
2019-11-10 03:11:43 +09:00
|
|
|
generated_playlist = GeneratedPlaylist.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert generated_playlist.type == self.type
|
|
|
|
assert generated_playlist.ready == self.ready
|
|
|
|
assert generated_playlist.notify == self.notify
|
|
|
|
assert generated_playlist.data == playlist
|
|
|
|
|
|
|
|
def test_de_json_all(self, client, playlist):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'type_': self.type,
|
|
|
|
'ready': self.ready,
|
|
|
|
'notify': self.notify,
|
|
|
|
'data': playlist.to_dict(),
|
|
|
|
'description': self.description,
|
|
|
|
}
|
2019-11-10 03:11:43 +09:00
|
|
|
generated_playlist = GeneratedPlaylist.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert generated_playlist.type == self.type
|
|
|
|
assert generated_playlist.ready == self.ready
|
|
|
|
assert generated_playlist.notify == self.notify
|
|
|
|
assert generated_playlist.data == playlist
|
Добавлен новый класс LicenceTextPart.
Поля cheapest, title, family_sub, fb_image, fb_name, family, intro_period_duration, intro_price, start_period_duration, start_price, licence_text_parts для Product.
Поля storage_dir, duplicates для Album.
Поле subscribed для ArtistEvent.
Поле description для GeneratedPlaylist.
Поле genre для Event.
Поле show_in_regions для Genre.
Поле cover_uri для MixLink.
Поля og_description, top_artist для Playlist.
Поля full_image_url, mts_full_image_url для Station.
Документация и тесты к новым поля. #339
2020-06-07 05:48:32 +09:00
|
|
|
assert generated_playlist.description == self.description
|
2019-11-10 03:11:43 +09:00
|
|
|
|
|
|
|
def test_equality(self, playlist):
|
|
|
|
a = GeneratedPlaylist(self.type, self.ready, self.notify, playlist)
|
|
|
|
b = GeneratedPlaylist(self.type, False, self.notify, None)
|
|
|
|
c = GeneratedPlaylist(self.type, self.ready, self.notify, playlist)
|
|
|
|
|
|
|
|
assert a != b
|
|
|
|
assert hash(a) != hash(b)
|
|
|
|
assert a is not b
|
|
|
|
|
|
|
|
assert a == c
|