2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import TrackWithAds
|
|
|
|
|
|
|
|
|
|
|
|
class TestTrackWithAds:
|
Добавлены основные тесты для следующих классов: AlbumEvent, AlbumsLikes, ArtistEvent, ArtistsLikes, ChartItem, Dashboard, Day, Event, Sequence, StationTracksResult, Supplement, TrackWithAds.
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Отрефакторен conftest.py.
Исправлен баг в .to_dict() методе, связанный с не рекурсивной десериализацией объектов списков и словарей.
Исправлен баг с десериализацией artist в классе ArtistEvent
2019-11-09 22:43:02 +09:00
|
|
|
type = 'track'
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, track_with_ads, track):
|
|
|
|
assert track_with_ads.type == self.type
|
|
|
|
assert track_with_ads.track == track
|
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert TrackWithAds.de_json({}, client) is None
|
|
|
|
|
2019-12-29 17:06:27 +09:00
|
|
|
def test_de_list_none(self, client):
|
|
|
|
assert TrackWithAds.de_list({}, client) == []
|
|
|
|
|
2019-11-08 02:09:39 +09:00
|
|
|
def test_de_json_required(self, client, track):
|
2021-09-19 22:47:19 +09:00
|
|
|
json_dict = {'type': self.type, 'track': track.to_dict()}
|
2019-11-08 02:09:39 +09:00
|
|
|
track_with_ads = TrackWithAds.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert track_with_ads.type == self.type
|
|
|
|
assert track_with_ads.track == track
|
|
|
|
|
|
|
|
def test_de_json_all(self, client, track):
|
2021-09-19 22:47:19 +09:00
|
|
|
json_dict = {'type': self.type, 'track': track.to_dict()}
|
2019-11-08 02:09:39 +09:00
|
|
|
track_with_ads = TrackWithAds.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert track_with_ads.type == self.type
|
|
|
|
assert track_with_ads.track == track
|
|
|
|
|
Добавлены основные тесты для следующих классов: AlbumEvent, AlbumsLikes, ArtistEvent, ArtistsLikes, ChartItem, Dashboard, Day, Event, Sequence, StationTracksResult, Supplement, TrackWithAds.
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Отрефакторен conftest.py.
Исправлен баг в .to_dict() методе, связанный с не рекурсивной десериализацией объектов списков и словарей.
Исправлен баг с десериализацией artist в классе ArtistEvent
2019-11-09 22:43:02 +09:00
|
|
|
def test_equality(self, track):
|
|
|
|
a = TrackWithAds(self.type, track)
|
|
|
|
b = TrackWithAds('', track)
|
|
|
|
c = TrackWithAds(self.type, track)
|
|
|
|
|
|
|
|
assert a != b
|
|
|
|
assert hash(a) != hash(b)
|
|
|
|
assert a is not b
|
|
|
|
|
|
|
|
assert a == c
|