Skip to content

Commit 202a64c

Browse files
committed
Tests
1 parent 164a1e8 commit 202a64c

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@
4343
port=SOCKS5_IPV4_PORT_WO_AUTH
4444
)
4545

46-
SOCKS4_URL = 'socks4://{host}:{port}'.format(
46+
SOCKS4_URL = 'socks4://{login}:{password}@{host}:{port}'.format(
4747
host=SOCKS4_HOST,
4848
port=SOCKS4_PORT,
49+
login=LOGIN,
50+
password='',
4951
)
5052

5153
HTTP_PROXY_URL = 'http://{login}:{password}@{host}:{port}'.format(

tests/test_core_socks_sync.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from tests.conftest import (
1919
SOCKS5_IPV4_HOST, SOCKS5_IPV4_PORT, LOGIN, PASSWORD, SKIP_IPV6_TESTS,
2020
SOCKS5_IPV4_URL, SOCKS5_IPV4_URL_WO_AUTH, SOCKS5_IPV6_URL, SOCKS4_URL,
21-
HTTP_PROXY_URL
21+
HTTP_PROXY_URL, HTTP_PROXY_HOST, HTTP_PROXY_PORT
2222
)
2323

2424
# TEST_URL = 'https://httpbin.org/ip'
@@ -147,6 +147,18 @@ def test_http_proxy():
147147
assert status_code == 200
148148

149149

150+
def test_http_proxy_with_invalid_credentials():
151+
proxy = Proxy.create(
152+
proxy_type=ProxyType.HTTP,
153+
host=HTTP_PROXY_HOST,
154+
port=HTTP_PROXY_PORT,
155+
username=LOGIN,
156+
password=PASSWORD + 'aaa',
157+
)
158+
with pytest.raises(ProxyError):
159+
make_request(proxy=proxy, url=TEST_URL)
160+
161+
150162
def test_proxy_chain():
151163
proxy = ProxyChain([
152164
Proxy.from_url(SOCKS5_IPV4_URL),

0 commit comments

Comments
 (0)