Remove duplicate test
This commit is contained in:
parent
668a77ade0
commit
ccbe6cd940
@ -31,7 +31,7 @@ SOCKS5 proxies can be tested with the `validate_socks` method. The method takes
|
||||
string as its only argument. It returns a `requests.Response` object if the request is successful
|
||||
with no issues, otherwise it will raise an exception and the caller can decide how to proceed.
|
||||
|
||||
For an example implementation, see [main.py](main.py).
|
||||
For an example implementation, see [main.py](main.py).
|
||||
|
||||
## Testing
|
||||
I was trying to get into the habit of writing unit tests, but god damn I hate them. There are
|
||||
@ -42,6 +42,6 @@ pip install -r requirement-dev.txt
|
||||
pytest -v
|
||||
```
|
||||
|
||||
## Greets
|
||||
## Greetz
|
||||
Shoutouts to [acidvegas](https://git.supernets.org/acidvegas/). This project was inspired by
|
||||
[proxytools](https://git.supernets.org/acidvegas/proxytools)
|
||||
the scripts in [proxytools](https://git.supernets.org/acidvegas/proxytools).
|
@ -6,6 +6,7 @@ from harvester.proxy import fetch_list, fetch_all
|
||||
|
||||
@pytest.fixture(scope='session', autouse=True)
|
||||
def start_web_server():
|
||||
"""Start a local webserver to serve unit test data."""
|
||||
server_process = subprocess.Popen(['python', '-m', 'http.server', '8888'], cwd='tests/data')
|
||||
time.sleep(1)
|
||||
|
||||
@ -15,23 +16,19 @@ def start_web_server():
|
||||
|
||||
|
||||
def test_fetch_list():
|
||||
"""Proxies should be returned in the form of [username:password]@ip:port."""
|
||||
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002']
|
||||
result = fetch_list('http://localhost:8888/proxies1.txt')
|
||||
assert set(expected).issubset(result)
|
||||
|
||||
|
||||
def test_fetch_list_fail():
|
||||
"""Failures are logged to console and an empty list is returned."""
|
||||
expected = []
|
||||
result = fetch_list('http://localhost:12345/proxies1.txt')
|
||||
assert result == expected
|
||||
|
||||
|
||||
def test_fetch_list_only_valid():
|
||||
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002']
|
||||
result = fetch_list('http://localhost:8888/proxies1.txt')
|
||||
assert set(expected).issubset(result)
|
||||
|
||||
|
||||
def test_fetch_all():
|
||||
expected = ['127.0.0.1:9000', '127.0.0.1:9001', 'username:pa$$@word@127.0.0.1:9002', '127.0.0.1:9999']
|
||||
result = fetch_all(['http://localhost:8888/proxies1.txt', 'http://localhost:8888/proxies2.txt'])
|
||||
|
Loading…
Reference in New Issue
Block a user