Debian Codegraph @

tests/test_client_side_socks.py

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 import pytest
•2 try:
3 from siosocks.exceptions import SocksException
4 HAS_SIOSOCKS = True
5 except ImportError:
6 HAS_SIOSOCKS = False
7
8
•9 @pytest.mark.skipif(not HAS_SIOSOCKS, reason="requires siosocks package")
10 @pytest.mark.asyncio
11 async def test_socks_success(pair_factory, Client, socks):
12 client = Client(
13 socks_host=socks.host,
14 socks_port=socks.port,
15 socks_version=5,
16 username="foo",
17 password="bar",
18 )
19 async with pair_factory(client):
20 pass
21
22
•23 @pytest.mark.skipif(not HAS_SIOSOCKS, reason="requires siosocks package")
24 @pytest.mark.asyncio
25 async def test_socks_fail(pair_factory, Client, socks):
26 client = Client(
27 socks_host=socks.host,
28 socks_port=socks.port,
29 socks_version=5,
30 username="bar",
31 password="bar",
32 )
33 with pytest.raises(SocksException):
34 async with pair_factory(client):
35 pass