fix proxy keys (#355)

* fix proxy keys

* fix all tests

* fix tor test
This commit is contained in:
callebtc
2023-11-09 17:03:45 -03:00
committed by GitHub
parent a4abbc2eee
commit 84cbeb6d30
5 changed files with 40 additions and 198 deletions

View File

@@ -1,22 +1,22 @@
import httpx
import pytest
import requests
from cashu.tor.tor import TorProxy
@pytest.mark.asyncio
@pytest.mark.skip(reason="Tor is not installed on CI")
def test_tor_setup():
s = requests.Session()
async def test_tor_setup():
tor = TorProxy(timeout=False)
tor.run_daemon()
socks_host, socks_port = "localhost", 9050
proxies = {
"http": f"socks5://{socks_host}:{socks_port}",
"https": f"socks5://{socks_host}:{socks_port}",
"all://": f"socks5://{socks_host}:{socks_port}",
}
s.proxies.update(proxies)
client = httpx.AsyncClient(
proxies=proxies, # type: ignore
)
resp = s.get("https://google.com")
resp = await client.get("https://www.wikipedia.org/")
resp.raise_for_status()