2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import User
|
|
|
|
|
|
|
|
|
|
|
|
class TestUser:
|
2019-11-08 04:52:26 +09:00
|
|
|
uid = 503646255
|
|
|
|
login = 'yamusic-daily'
|
|
|
|
name = 'yamusic-daily'
|
2020-06-06 23:06:23 +09:00
|
|
|
display_name = 'Ilya (Marshal)'
|
|
|
|
full_name = 'Илья'
|
2019-11-08 04:52:26 +09:00
|
|
|
sex = 'unknown'
|
|
|
|
verified = False
|
Метод de_list в TrackId.
Поля coauthors и recent_tracks в Playlist.
Поле regions в User.
Поля users, podcasts, podcast_episodes, type_, page, per_page в Search.
Поддержка новых типов поиска: подкасты, выпуски, пользователи.
Поля short_description, description, is_premiere, is_banner в Like.
Документация и тесты к новым поля. #339
2020-06-07 18:55:30 +09:00
|
|
|
regions = ['RUSSIA_PREMIUM', 'RUSSIA']
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, user):
|
|
|
|
assert user.uid == self.uid
|
|
|
|
assert user.login == self.login
|
|
|
|
assert user.name == self.name
|
2020-06-06 23:06:23 +09:00
|
|
|
assert user.display_name == self.display_name
|
|
|
|
assert user.full_name == self.full_name
|
2019-11-08 02:09:39 +09:00
|
|
|
assert user.sex == self.sex
|
|
|
|
assert user.verified == self.verified
|
Метод de_list в TrackId.
Поля coauthors и recent_tracks в Playlist.
Поле regions в User.
Поля users, podcasts, podcast_episodes, type_, page, per_page в Search.
Поддержка новых типов поиска: подкасты, выпуски, пользователи.
Поля short_description, description, is_premiere, is_banner в Like.
Документация и тесты к новым поля. #339
2020-06-07 18:55:30 +09:00
|
|
|
assert user.regions == self.regions
|
2019-11-08 02:09:39 +09:00
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert User.de_json({}, client) is None
|
|
|
|
|
Метод de_list в TrackId.
Поля coauthors и recent_tracks в Playlist.
Поле regions в User.
Поля users, podcasts, podcast_episodes, type_, page, per_page в Search.
Поддержка новых типов поиска: подкасты, выпуски, пользователи.
Поля short_description, description, is_premiere, is_banner в Like.
Документация и тесты к новым поля. #339
2020-06-07 18:55:30 +09:00
|
|
|
def test_de_list_none(self, client):
|
|
|
|
assert User.de_list({}, client) == []
|
|
|
|
|
2019-11-08 02:09:39 +09:00
|
|
|
def test_de_json_required(self, client):
|
2020-06-06 23:06:23 +09:00
|
|
|
json_dict = {'uid': self.uid, 'login': self.login}
|
2019-11-08 02:09:39 +09:00
|
|
|
user = User.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert user.uid == self.uid
|
|
|
|
assert user.login == self.login
|
|
|
|
|
|
|
|
def test_de_json_all(self, client):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'uid': self.uid,
|
|
|
|
'login': self.login,
|
|
|
|
'name': self.name,
|
|
|
|
'sex': self.sex,
|
|
|
|
'verified': self.verified,
|
|
|
|
'display_name': self.display_name,
|
|
|
|
'full_name': self.full_name,
|
|
|
|
'regions': self.regions,
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
user = User.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert user.uid == self.uid
|
|
|
|
assert user.login == self.login
|
|
|
|
assert user.name == self.name
|
2020-06-06 23:06:23 +09:00
|
|
|
assert user.display_name == self.display_name
|
|
|
|
assert user.full_name == self.full_name
|
2019-11-08 02:09:39 +09:00
|
|
|
assert user.sex == self.sex
|
|
|
|
assert user.verified == self.verified
|
Метод de_list в TrackId.
Поля coauthors и recent_tracks в Playlist.
Поле regions в User.
Поля users, podcasts, podcast_episodes, type_, page, per_page в Search.
Поддержка новых типов поиска: подкасты, выпуски, пользователи.
Поля short_description, description, is_premiere, is_banner в Like.
Документация и тесты к новым поля. #339
2020-06-07 18:55:30 +09:00
|
|
|
assert user.regions == self.regions
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_equality(self):
|
2020-06-06 23:06:23 +09:00
|
|
|
a = User(self.uid, self.login)
|
|
|
|
b = User(1, self.login)
|
|
|
|
c = User(self.uid, self.login)
|
2019-11-08 04:52:26 +09:00
|
|
|
|
|
|
|
assert a != b
|
|
|
|
assert hash(a) != hash(b)
|
|
|
|
assert a is not b
|
|
|
|
|
|
|
|
assert a == c
|