-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
test_dashboard.py
48 lines (34 loc) · 1.71 KB
/
test_dashboard.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
46
47
48
import pytest
from yandex_music import Dashboard
@pytest.fixture(scope='class')
def dashboard(station_result):
return Dashboard(TestDashboard.dashboard_id, [station_result], TestDashboard.pumpkin)
class TestDashboard:
dashboard_id = '1573229923780896-4168369461406125948'
pumpkin = False
def test_expected_values(self, dashboard, station_result):
assert dashboard.dashboard_id == self.dashboard_id
assert dashboard.stations == [station_result]
assert dashboard.pumpkin == self.pumpkin
def test_de_json_none(self, client):
assert Dashboard.de_json({}, client) is None
def test_de_json_required(self, client, station_result):
json_dict = {'dashboard_id': self.dashboard_id, 'stations': [station_result.to_dict()], 'pumpkin': self.pumpkin}
dashboard = Dashboard.de_json(json_dict, client)
assert dashboard.dashboard_id == self.dashboard_id
assert dashboard.stations == [station_result]
assert dashboard.pumpkin == self.pumpkin
def test_de_json_all(self, client, station_result):
json_dict = {'dashboard_id': self.dashboard_id, 'stations': [station_result.to_dict()], 'pumpkin': self.pumpkin}
dashboard = Dashboard.de_json(json_dict, client)
assert dashboard.dashboard_id == self.dashboard_id
assert dashboard.stations == [station_result]
assert dashboard.pumpkin == self.pumpkin
def test_equality(self, station):
a = Dashboard(self.dashboard_id, [station], self.pumpkin)
b = Dashboard('', [station], True)
c = Dashboard(self.dashboard_id, [station], self.pumpkin)
assert a != b
assert hash(a) != hash(b)
assert a is not b
assert a == c