From f57c45f362b74d6b3c1ba8cd2b2c1308ca8e4190 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 31 Jan 2024 13:18:03 +0100 Subject: [PATCH] adding test --- changedetectionio/tests/test_request.py | 4 ++++ changedetectionio/tests/util.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/changedetectionio/tests/test_request.py b/changedetectionio/tests/test_request.py index 9586363f..9fab7da5 100644 --- a/changedetectionio/tests/test_request.py +++ b/changedetectionio/tests/test_request.py @@ -78,6 +78,10 @@ def test_headers_in_request(client, live_server): if (len(app_struct['watching'][uuid]['headers'])): watches_with_headers += 1 + for k, watch in client.application.config.get('DATASTORE').data.get('watching').items(): + assert 'werkzeug' in watch.get('remote_server_reply') + assert 'custom' in watch.get('remote_server_reply') # added in util.py, it should append it with a , to the original one + # Should be only one with headers set assert watches_with_headers==1 res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True) diff --git a/changedetectionio/tests/util.py b/changedetectionio/tests/util.py index ed1e424e..5974e47a 100644 --- a/changedetectionio/tests/util.py +++ b/changedetectionio/tests/util.py @@ -175,12 +175,16 @@ def live_server_setup(live_server): @live_server.app.route('/test-headers') def test_headers(): - output= [] + output = [] for header in request.headers: - output.append("{}:{}".format(str(header[0]),str(header[1]) )) + output.append("{}:{}".format(str(header[0]), str(header[1]))) - return "\n".join(output) + content = "\n".join(output) + + resp = make_response(content, 200) + resp.headers['server'] = 'custom' + return resp # Just return the body in the request @live_server.app.route('/test-body', methods=['POST', 'GET'])