|
|
@ -1,12 +1,27 @@
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import time
|
|
|
|
|
|
|
|
from flask import url_for
|
|
|
|
from flask import url_for
|
|
|
|
from changedetectionio.tests.util import live_server_setup, wait_for_all_checks
|
|
|
|
from changedetectionio.tests.util import live_server_setup, wait_for_all_checks
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def set_response():
|
|
|
|
|
|
|
|
import time
|
|
|
|
|
|
|
|
data = f"""<html>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<h1>Awesome, you made it</h1>
|
|
|
|
|
|
|
|
yeah the socks request worked
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with open("test-datastore/endpoint-content.txt", "w") as f:
|
|
|
|
|
|
|
|
f.write(data)
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_socks5(client, live_server, measure_memory_usage):
|
|
|
|
def test_socks5(client, live_server, measure_memory_usage):
|
|
|
|
live_server_setup(live_server)
|
|
|
|
live_server_setup(live_server)
|
|
|
|
|
|
|
|
set_response()
|
|
|
|
|
|
|
|
|
|
|
|
# Setup a proxy
|
|
|
|
# Setup a proxy
|
|
|
|
res = client.post(
|
|
|
|
res = client.post(
|
|
|
@ -24,7 +39,10 @@ def test_socks5(client, live_server, measure_memory_usage):
|
|
|
|
|
|
|
|
|
|
|
|
assert b"Settings updated." in res.data
|
|
|
|
assert b"Settings updated." in res.data
|
|
|
|
|
|
|
|
|
|
|
|
test_url = "https://changedetection.io/CHANGELOG.txt?socks-test-tag=" + os.getenv('SOCKSTEST', '')
|
|
|
|
# Because the socks server should connect back to us
|
|
|
|
|
|
|
|
test_url = url_for('test_endpoint', _external=True) + f"?socks-test-tag={os.getenv('SOCKSTEST', '')}"
|
|
|
|
|
|
|
|
test_url = test_url.replace('localhost.localdomain', 'cdio')
|
|
|
|
|
|
|
|
test_url = test_url.replace('localhost', 'cdio')
|
|
|
|
|
|
|
|
|
|
|
|
res = client.post(
|
|
|
|
res = client.post(
|
|
|
|
url_for("form_quick_watch_add"),
|
|
|
|
url_for("form_quick_watch_add"),
|
|
|
@ -60,4 +78,4 @@ def test_socks5(client, live_server, measure_memory_usage):
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# Should see the proper string
|
|
|
|
# Should see the proper string
|
|
|
|
assert "+0200:".encode('utf-8') in res.data
|
|
|
|
assert "Awesome, you made it".encode('utf-8') in res.data
|
|
|
|