tests: add unit test infrastructure

pytest-based test suite with fixtures for database testing.
Covers misc.py utilities, dbs.py operations, and fetch.py validation.
Includes mock_network.py for future network testing.
This commit is contained in:
Username
2026-01-08 01:42:38 +01:00
parent c1ec5d593b
commit 44604f1ce3
9 changed files with 1490 additions and 0 deletions

31
tests/fixtures/sample_html.txt vendored Normal file
View File

@@ -0,0 +1,31 @@
<html>
<body>
<h1>Free Proxy List</h1>
<table>
<tr>
<th>IP Address</th>
<th>Port</th>
<th>Type</th>
<th>Country</th>
</tr>
<tr>
<td>1.2.3.4</td>
<td>8080</td>
<td>SOCKS5</td>
<td>US</td>
</tr>
<tr>
<td>5.6.7.8</td>
<td>3128</td>
<td>HTTP</td>
<td>DE</td>
</tr>
<tr>
<td>9.10.11.12</td>
<td>1080</td>
<td>SOCKS4</td>
<td>FR</td>
</tr>
</table>
</body>
</html>

5
tests/fixtures/sample_json.txt vendored Normal file
View File

@@ -0,0 +1,5 @@
[
{"ip": "1.2.3.4", "port": 8080, "type": "socks5"},
{"ip": "5.6.7.8", "port": 3128, "type": "http"},
{"host": "9.10.11.12", "port": 1080, "protocol": "socks4"}
]

24
tests/fixtures/sample_mixed.txt vendored Normal file
View File

@@ -0,0 +1,24 @@
Free Proxy List - Updated Daily
Plain proxies:
1.2.3.4:8080
5.6.7.8:3128
9.10.11.12:1080
With protocol hints:
socks5 11.22.33.44:1080
http: 55.66.77.88:8080
socks4 - 99.100.101.102:1080
Auth proxies:
user:pass@111.112.113.114:8080
socks5://admin:secret@115.116.117.118:1080
JSON embedded:
{"data": [{"ip": "121.122.123.124", "port": 8080}]}
Table format:
<table>
<tr><th>IP</th><th>Port</th></tr>
<tr><td>131.132.133.134</td><td>3128</td></tr>
</table>