-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
async def test_proxy_connect(vms): | ||
async with vms.hub.ssh_task("not-my-board hub", "hub"): | ||
async with vms.hub.ssh_task( | ||
"tinyproxy -d -c ./src/tests/tinyproxy.conf", "tinyproxy" | ||
): | ||
# wait for listening sockets | ||
await vms.hub.ssh_poll("nc -z 127.0.0.1 2092") | ||
await vms.hub.ssh_poll("nc -z 127.0.0.1 8888") | ||
|
||
result = await vms.hub.ssh( | ||
( | ||
"http_proxy=http://127.0.0.1:8888 " | ||
"python3 -m not_my_board._http http://hub.local:2092/api/v1/places" | ||
), | ||
prefix="http GET", | ||
) | ||
assert result.stdout == "{'places': []}" | ||
|
||
|
||
async def test_proxy_connect_https(vms): | ||
async with vms.hub.ssh_task( | ||
( | ||
"uvicorn --host 0.0.0.0 --port 2092 " | ||
"--ssl-keyfile /etc/not-my-board/not-my-board.key " | ||
"--ssl-certfile /etc/not-my-board/not-my-board.crt " | ||
"not_my_board:asgi_app" | ||
), | ||
"hub", | ||
): | ||
async with vms.hub.ssh_task( | ||
"tinyproxy -d -c ./src/tests/tinyproxy.conf", "tinyproxy" | ||
): | ||
# wait for listening sockets | ||
await vms.hub.ssh_poll("nc -z 127.0.0.1 2092") | ||
await vms.hub.ssh_poll("nc -z 127.0.0.1 8888") | ||
|
||
result = await vms.hub.ssh( | ||
( | ||
"https_proxy=http://127.0.0.1:8888 " | ||
"python3 -m not_my_board._http " | ||
"--cacert /etc/not-my-board/not-my-board-root-ca.crt " | ||
"https://hub.local:2092/api/v1/places" | ||
), | ||
prefix="http GET", | ||
) | ||
assert result.stdout == "{'places': []}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Port 8888 | ||
Listen 127.0.0.1 | ||
Timeout 600 | ||
Allow 127.0.0.1 |