-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
161 lines (127 loc) · 4.11 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
from aio2ch import (
Api,
Board,
Thread,
Image,
Video,
Sticker
)
import pytest
@pytest.fixture
async def client():
async with Api(timeout=10.0) as api_client:
yield api_client
@pytest.fixture
async def client_ujson():
from ujson import loads as ujson_loads
async with Api(json_loads=ujson_loads) as api_client:
yield api_client
@pytest.fixture
async def client_orjson():
from orjson import loads as orjson_loads
async with Api(json_loads=orjson_loads) as api_client:
yield api_client
@pytest.fixture
def board():
test_board_data = {
"bump_limit": "",
"category": "",
"default_name": "",
"id": "test",
"info": "",
"name": "test",
"threads": ""
}
return Board(test_board_data)
@pytest.fixture
def thread(thread_as_number):
test_thread_data = {
"comment": "",
"num": thread_as_number,
"posts_count": "",
"score": "",
"subject": "",
"timestamp": "",
"views": ""
}
test_board = "test"
return Thread(test_thread_data, test_board)
@pytest.fixture
def thread_as_number():
return 31814
@pytest.fixture
def thread_url(thread_as_number):
return f"https://2ch.hk/test/res/{thread_as_number}.html"
@pytest.fixture
def invalid_thread():
return "invalid-thread"
@pytest.fixture
def invalid_board():
return "thisboarddoesntexist"
@pytest.fixture
def number_of_threads(number=5):
return number
@pytest.fixture
def raw_text():
return "КУКУ ТАМ ОНЛИФЕНС СЛИЛИ, ЕСТЬ ЧТО У КОГО?<br>" \
"<a href=\"https://tjournal.ru/internet/146526-v-set-popali-terabayty-" \
"dannyh-onlyfans-sayta-gde-pornozvezdy-i-modeli-razmeshchayut-platnye-eroticheskie-foto-i-video\" " \
"target=\"_blank\" rel=\"nofollow noopener noreferrer\">https://tjournal.ru/internet/" \
"146526-v-set-popali-terabayty-dannyh-onlyfans-sayta-gde-pornozvezdy-i-modeli-razmeshchayut-platnye-" \
"eroticheskie-foto-i-video</a><br><br>Давайте братья скажите где скачать эти терабайты"
@pytest.fixture
def clean_text():
return "КУКУ ТАМ ОНЛИФЕНС СЛИЛИ, ЕСТЬ ЧТО У КОГО?\n" \
"https://tjournal.ru/internet/146526-v-set-popali-terabayty-dannyh-onlyfans-" \
"sayta-gde-pornozvezdy-i-modeli-razmeshchayut-platnye-eroticheskie-foto-i-video\n\n" \
"Давайте братья скажите где скачать эти терабайты"
@pytest.fixture
def thread_media():
image_data = {
"displayname": "pnX1uujobqQ.jpg",
"fullname": "pnX1uujobqQ.jpg",
"height": 600,
"md5": "50a7ca2ed41d00a0f49dd81bbc32074b",
"name": "14989172638190.jpg",
"nsfw": 0,
"path": "/test/src/30972/14989172638190.jpg",
"size": 62,
"thumbnail": "/test/thumb/30972/14989172638190s.jpg",
"tn_height": 250,
"tn_width": 250,
"type": 1,
"width": 600
}
video_data = {
"displayname": ".mp4",
"duration": "00:04:35",
"duration_secs": 275,
"fullname": ".mp4",
"height": 500,
"md5": "8614c802cff48b420d54ed62a18fe21c",
"name": "15752983961530.mp4",
"nsfw": 0,
"path": "/test/src/30972/15752983961530.mp4",
"size": 5613,
"thumbnail": "/test/thumb/30972/15752983961530s.jpg",
"tn_height": 200,
"tn_width": 200,
"type": 10,
"width": 500
}
sticker_data = {
"displayname": "Стикер",
"height": 512,
"install": "/makaba/stickers/show/n5xSPtEw",
"name": "lKfUbr3j.png",
"pack": "n5xSPtEw",
"path": "/stickers/n5xSPtEw/lKfUbr3j.png",
"size": 383,
"sticker": "lKfUbr3j",
"thumbnail": "/stickers/n5xSPtEw/lKfUbr3j_thumb.png",
"tn_height": 200,
"tn_width": 200,
"type": 100,
"width": 512
}
return Image(image_data), Video(video_data), Sticker(sticker_data)