🤬
  • ■ ■ ■ ■ ■
    changedetectionio/run_all_tests.sh
    skipped 69 lines
    70 70   
    71 71   
    72 72  # 2nd test actually choose the preferred proxy from proxies.json
    73  -#cp tests/proxy_list/proxies.json-example ./test-datastore/proxies.json
    74  -#pytest tests/proxy_list/test_multiple_proxy.py
     73 +cp tests/proxy_list/proxies.json-example ./test-datastore/proxies.json
     74 +# Makes a watch use a preferred proxy
     75 +pytest tests/proxy_list/test_multiple_proxy.py
     76 + 
     77 +# Should be a request in the default "first" squid
     78 +docker logs $$-squid-one 2>/dev/null|grep chosen.changedetection.io
     79 +if [ $? -ne 0 ]
     80 +then
     81 + echo "Did not see a request to chosen.changedetection.io in the squid logs (while checking preferred proxy)"
     82 +fi
    75 83   
     84 +# And one in the 'second' squid (user selects this as preferred)
     85 +docker logs $$-squid-two 2>/dev/null|grep chosen.changedetection.io
     86 +if [ $? -ne 0 ]
     87 +then
     88 + echo "Did not see a request to chosen.changedetection.io in the squid logs (while checking preferred proxy)"
     89 +fi
    76 90   
     91 +# @todo - test system override proxy selection and watch defaults, setup a 3rd squid?
    77 92  docker kill $$-squid-one
    78 93  docker kill $$-squid-two
    79 94   
    skipped 2 lines
  • ■ ■ ■ ■ ■
    changedetectionio/tests/proxy_list/test_multiple_proxy.py
    skipped 1 lines
    2 2   
    3 3  import time
    4 4  from flask import url_for
    5  -from ..util import live_server_setup, wait_for_all_checks, extract_UUID_from_client
     5 +from ..util import live_server_setup
    6 6   
    7  -def test_check_basic_change_detection_functionality(client, live_server):
     7 +def test_preferred_proxy(client, live_server):
    8 8   time.sleep(1)
    9 9   live_server_setup(live_server)
    10 10   time.sleep(1)
     11 + url = "http://chosen.changedetection.io"
     12 + 
    11 13   res = client.post(
    12 14   url_for("import_page"),
    13 15   # Because a URL wont show in squid/proxy logs due it being SSLed
    14 16   # Use plain HTTP or a specific domain-name here
    15  - data={"urls": "http://one.changedetection.io"},
     17 + data={"urls": url},
    16 18   follow_redirects=True
    17 19   )
    18 20   
    19  - assert b"1 Imported" in res.data
     21 + assert b"2 Imported" in res.data
     22 + 
    20 23   time.sleep(2)
     24 + res = client.post(
     25 + url_for("edit_page", uuid="first"),
     26 + data={
     27 + "css_filter": "",
     28 + "fetch_backend": "html_requests",
     29 + "headers": "",
     30 + "proxy": "proxy-two",
     31 + "tag": "",
     32 + "url": url,
     33 + },
     34 + follow_redirects=True
     35 + )
     36 + assert b"Updated watch." in res.data
     37 + time.sleep(2)
     38 + # Now the request should appear in the second-squid logs
    21 39   
Please wait...
Page is in error, reload to recover