2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import MixLink
|
|
|
|
|
|
|
|
|
|
|
|
class TestMixLink:
|
2019-11-08 06:37:53 +09:00
|
|
|
title = 'Беларусь'
|
|
|
|
url = '/tag/belarus'
|
|
|
|
url_scheme = 'yandexmusic://tag/belarus'
|
|
|
|
text_color = '#6c65a9'
|
|
|
|
background_color = 'transparent'
|
2021-02-03 21:28:10 +09:00
|
|
|
background_image_uri = (
|
|
|
|
'avatars.yandex.net/get-music-misc/28592/mix.5cf0bd5e58ea3a1e70caa07b.' 'background-image.1559281047248/%%'
|
|
|
|
)
|
2019-11-08 06:37:53 +09:00
|
|
|
cover_white = 'avatars.yandex.net/get-music-misc/28052/mix.5cf0bd5e58ea3a1e70caa07b.cover-white.1559281049219/%%'
|
Добавлен новый класс 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
|
|
|
cover_uri = 'avatars.yandex.net/get-music-misc/34161/mix.57c6d15a2d3213a86ac653d2.cover.1555818786846/%%'
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, mix_link):
|
|
|
|
assert mix_link.title == self.title
|
|
|
|
assert mix_link.url == self.url
|
|
|
|
assert mix_link.url_scheme == self.url_scheme
|
|
|
|
assert mix_link.text_color == self.text_color
|
|
|
|
assert mix_link.background_color == self.background_color
|
|
|
|
assert mix_link.background_image_uri == self.background_image_uri
|
|
|
|
assert mix_link.cover_white == self.cover_white
|
Добавлен новый класс 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 mix_link.cover_uri == self.cover_uri
|
2019-11-08 02:09:39 +09:00
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert MixLink.de_json({}, client) is None
|
|
|
|
|
2019-12-29 17:06:27 +09:00
|
|
|
def test_de_list_none(self, client):
|
|
|
|
assert MixLink.de_list({}, client) == []
|
|
|
|
|
2019-11-08 02:09:39 +09:00
|
|
|
def test_de_json_required(self, client):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'title': self.title,
|
|
|
|
'url': self.url,
|
|
|
|
'url_scheme': self.url_scheme,
|
|
|
|
'text_color': self.text_color,
|
|
|
|
'background_color': self.background_color,
|
|
|
|
'background_image_uri': self.background_image_uri,
|
|
|
|
'cover_white': self.cover_white,
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
mix_link = MixLink.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert mix_link.title == self.title
|
|
|
|
assert mix_link.url == self.url
|
|
|
|
assert mix_link.url_scheme == self.url_scheme
|
|
|
|
assert mix_link.text_color == self.text_color
|
|
|
|
assert mix_link.background_color == self.background_color
|
|
|
|
assert mix_link.background_image_uri == self.background_image_uri
|
|
|
|
assert mix_link.cover_white == self.cover_white
|
|
|
|
|
|
|
|
def test_de_json_all(self, client):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'title': self.title,
|
|
|
|
'url': self.url,
|
|
|
|
'url_scheme': self.url_scheme,
|
|
|
|
'text_color': self.text_color,
|
|
|
|
'background_color': self.background_color,
|
|
|
|
'background_image_uri': self.background_image_uri,
|
|
|
|
'cover_white': self.cover_white,
|
|
|
|
'cover_uri': self.cover_uri,
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
mix_link = MixLink.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert mix_link.title == self.title
|
|
|
|
assert mix_link.url == self.url
|
|
|
|
assert mix_link.url_scheme == self.url_scheme
|
|
|
|
assert mix_link.text_color == self.text_color
|
|
|
|
assert mix_link.background_color == self.background_color
|
|
|
|
assert mix_link.background_image_uri == self.background_image_uri
|
|
|
|
assert mix_link.cover_white == self.cover_white
|
Добавлен новый класс 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 mix_link.cover_uri == self.cover_uri
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_equality(self):
|
2021-02-03 21:28:10 +09:00
|
|
|
a = MixLink(
|
|
|
|
self.title,
|
|
|
|
self.url,
|
|
|
|
self.url_scheme,
|
|
|
|
self.text_color,
|
|
|
|
self.background_color,
|
|
|
|
self.background_image_uri,
|
|
|
|
self.cover_white,
|
|
|
|
)
|
|
|
|
b = MixLink(
|
|
|
|
self.title,
|
|
|
|
self.url,
|
|
|
|
'',
|
|
|
|
self.text_color,
|
|
|
|
self.background_color,
|
|
|
|
self.background_image_uri,
|
|
|
|
self.cover_white,
|
|
|
|
)
|
|
|
|
c = MixLink(
|
|
|
|
self.title,
|
|
|
|
self.url,
|
|
|
|
self.url_scheme,
|
|
|
|
'#000000',
|
|
|
|
self.background_color,
|
|
|
|
self.background_image_uri,
|
|
|
|
self.cover_white,
|
|
|
|
)
|
|
|
|
d = MixLink(
|
|
|
|
self.title,
|
|
|
|
self.url,
|
|
|
|
self.url_scheme,
|
|
|
|
self.text_color,
|
|
|
|
self.background_color,
|
|
|
|
self.background_image_uri,
|
|
|
|
self.cover_white,
|
|
|
|
)
|
2019-11-08 06:37:53 +09:00
|
|
|
|
|
|
|
assert a != b != c
|
|
|
|
assert hash(a) != hash(b) != hash(c)
|
|
|
|
assert a is not b is not c
|
|
|
|
|
|
|
|
assert a == d
|