-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
test_invocation_info.py
45 lines (34 loc) · 1.6 KB
/
test_invocation_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from yandex_music import InvocationInfo
class TestInvocationInfo:
hostname = 'myt1-0261-c2e-msk-myt-music-st-e72-18274.gencfg-c.yandex.net'
req_id = '1573172241066040-16981638052883278246'
exec_duration_millis = 0
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
def test_de_json_none(self, client):
assert InvocationInfo.de_json({}, client) is None
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):
json_dict = {
'hostname': self.hostname,
'req_id': self.req_id,
'exec_duration_millis': self.exec_duration_millis,
}
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):
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