-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconftest.py
131 lines (93 loc) · 2.37 KB
/
conftest.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import pytest
import random
from unittest.mock import MagicMock
from polka_curses.controller import ViewController
from polka_curses.model import Model
from polka_curses.view import View
from polka_curses.config import Key, Mode
@pytest.fixture(scope="module")
def model():
class TestModel(Model):
def get_all(self):
pass
return TestModel()
@pytest.fixture(scope="module")
def books(model):
return model.books
@pytest.fixture(scope="module")
def lists(model):
return model.lists
@pytest.fixture(scope="module")
def experts(model):
return model.experts
@pytest.fixture(scope="module")
def podcasts(model):
return model.podcasts
@pytest.fixture(scope="module")
def podcast(podcasts):
return podcasts[0]
@pytest.fixture(scope="module")
def blogs(model):
return model.blogs
@pytest.fixture(scope="module")
def blog(blogs):
return blogs[0]
@pytest.fixture(scope="module")
def book(books):
return books[0]
@pytest.fixture(scope="module")
def not_book(expert, list_):
return random.choice([expert, list_])
@pytest.fixture(scope="module")
def list_(lists):
return lists[0]
@pytest.fixture(scope="module")
def not_list(book, expert):
return random.choice([book, expert])
@pytest.fixture(scope="module")
def expert(experts):
return experts[0]
@pytest.fixture(scope="module")
def not_expert(book, list_):
return random.choice([book, list_])
@pytest.fixture
def view(books):
view = View()
view.init(books)
return view
@pytest.fixture
def view_with_loading_page():
return View()
@pytest.fixture
def controller(view):
controller = ViewController()
controller.loop = MagicMock()
controller.view = view
controller.mode = Mode.BOOKS_PAGE
return controller
@pytest.fixture
def test_keys():
return [
Key(
name="Left",
description="ВЛЕВО",
buttons=["left"],
action="test_move_left",
modes=Mode.tabs(),
hidden=True,
),
Key(
name="Enter",
description="ОТКРЫТЬ",
buttons=["enter"],
action="test_open_book",
modes=Mode.tabs(),
),
Key(
name="Esc",
description="ВЫХОД",
buttons=["esc"],
action="test_exit",
modes=Mode.tabs(),
),
]