2019-11-08 02:09:39 +09:00
|
|
|
from yandex_music import InvocationInfo
|
|
|
|
|
|
|
|
|
|
|
|
class TestInvocationInfo:
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
hostname = 'myt1-0261-c2e-msk-myt-music-st-e72-18274.gencfg-c.yandex.net'
|
|
|
|
req_id = '1573172241066040-16981638052883278246'
|
2019-12-28 22:25:09 +09:00
|
|
|
exec_duration_millis = 0
|
2019-11-08 02:09:39 +09:00
|
|
|
|
|
|
|
def test_expected_values(self, invocation_info):
|
|
|
|
assert invocation_info.hostname == self.hostname
|
|
|
|
assert invocation_info.req_id == self.req_id
|
|
|
|
assert invocation_info.exec_duration_millis == self.exec_duration_millis
|
|
|
|
|
2019-12-29 16:38:24 +09:00
|
|
|
def test_de_json_none(self, client):
|
|
|
|
assert InvocationInfo.de_json({}, client) is None
|
|
|
|
|
2019-11-08 02:09:39 +09:00
|
|
|
def test_de_json_required(self, client):
|
|
|
|
json_dict = {'hostname': self.hostname, 'req_id': self.req_id}
|
|
|
|
invocation_info = InvocationInfo.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert invocation_info.hostname == self.hostname
|
|
|
|
assert invocation_info.req_id == self.req_id
|
|
|
|
|
|
|
|
def test_de_json_all(self, client):
|
2021-02-03 21:28:10 +09:00
|
|
|
json_dict = {
|
|
|
|
'hostname': self.hostname,
|
|
|
|
'req_id': self.req_id,
|
|
|
|
'exec_duration_millis': self.exec_duration_millis,
|
|
|
|
}
|
2019-11-08 02:09:39 +09:00
|
|
|
invocation_info = InvocationInfo.de_json(json_dict, client)
|
|
|
|
|
|
|
|
assert invocation_info.hostname == self.hostname
|
|
|
|
assert invocation_info.req_id == self.req_id
|
|
|
|
assert invocation_info.exec_duration_millis == self.exec_duration_millis
|
|
|
|
|
|
|
|
def test_equality(self):
|
Добавлены основные тесты для следующий классов: Account, CaseForms, Cover, DownloadInfo, Enum, InvocationInfo, Lyrics, MadeFor, Permissions, PersonalPlaylistsData, PlayContextsData, Promotion, RotorSettings, Subsription,
Исправлены фикстуры и сравнения для вышеперечисленных классов.
Починен conftest.py
2019-11-08 09:30:15 +09:00
|
|
|
a = InvocationInfo(self.hostname, self.req_id)
|
|
|
|
b = InvocationInfo('', self.req_id, 0)
|
|
|
|
c = InvocationInfo(self.hostname, self.req_id, 20)
|
|
|
|
|
|
|
|
assert a != b
|
|
|
|
assert hash(a) != hash(b)
|
|
|
|
assert a is not b
|
|
|
|
|
|
|
|
assert a == c
|