From 284d0a024639292fac48fcc5b39e6aca0db6ce03 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Mon, 22 May 2023 16:06:25 +0200 Subject: [PATCH] Tweaking test for global headers.txt --- changedetectionio/tests/conftest.py | 16 +++++++++------- changedetectionio/tests/test_request.py | 10 +++++++--- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/changedetectionio/tests/conftest.py b/changedetectionio/tests/conftest.py index 948c5792..d1068bbe 100644 --- a/changedetectionio/tests/conftest.py +++ b/changedetectionio/tests/conftest.py @@ -14,13 +14,15 @@ global app def cleanup(datastore_path): # Unlink test output files - files = ['output.txt', - 'url-watches.json', - 'secret.txt', - 'notification.txt', - 'count.txt', - 'endpoint-content.txt' - ] + files = [ + 'count.txt', + 'endpoint-content.txt' + 'headers.txt', + 'notification.txt', + 'secret.txt', + 'url-watches.json', + 'output.txt', + ] for file in files: try: os.unlink("{}/{}".format(datastore_path, file)) diff --git a/changedetectionio/tests/test_request.py b/changedetectionio/tests/test_request.py index 992a6428..4667b27f 100644 --- a/changedetectionio/tests/test_request.py +++ b/changedetectionio/tests/test_request.py @@ -1,4 +1,5 @@ import json +import os import time from flask import url_for from . util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks @@ -238,6 +239,7 @@ def test_method_in_request(client, live_server): assert b'Deleted' in res.data def test_headers_textfile_in_request(client, live_server): + # Add our URL to the import page test_url = url_for('test_headers', _external=True) @@ -286,9 +288,11 @@ def test_headers_textfile_in_request(client, live_server): url_for("preview_page", uuid="first"), follow_redirects=True ) - assert b"global-header: nice" in res.data - assert b"next-global-header: nice" in res.data - assert b"cool: yeah" in res.data + + assert b"Global-Header:nice" in res.data + assert b"Next-Global-Header:nice" in res.data + assert b"Xxx:ooo" in res.data + os.unlink('test-datastore/headers.txt') #unlink headers.txt on start/stop res = client.get(url_for("form_delete", uuid="all"), follow_redirects=True)