Compare commits

...

3 Commits

Author SHA1 Message Date
dgtlmoon
eb2560e77d some small extra checks 2023-11-09 18:53:11 +01:00
dgtlmoon
ab943c0c51 Improving test coverage 2023-11-09 18:49:50 +01:00
dgtlmoon
9d99f4cb59 Visual Selector - Fixing malformed elements.json grabber 2023-11-09 18:04:11 +01:00
2 changed files with 8 additions and 2 deletions

View File

@@ -1208,8 +1208,7 @@ def changedetection_app(config=None, datastore_o=None):
# These files should be in our subdirectory
try:
# set nocache, set content-type
watch_dir = datastore_o.datastore_path + "/" + filename
response = make_response(send_from_directory(filename="elements.json", directory=watch_dir, path=watch_dir + "/elements.json"))
response = make_response(send_from_directory(os.path.join(datastore_o.datastore_path, filename), "elements.json"))
response.headers['Content-type'] = 'application/json'
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
response.headers['Pragma'] = 'no-cache'

View File

@@ -54,6 +54,13 @@ def test_visual_selector_content_ready(client, live_server):
with open(os.path.join('test-datastore', uuid, 'elements.json'), 'r') as f:
json.load(f)
# Attempt to fetch it via the web hook that the browser would use
res = client.get(url_for('static_content', group='visual_selector_data', filename=uuid))
json.loads(res.data)
assert res.mimetype == 'application/json'
assert res.status_code == 200
# Some options should be enabled
# @todo - in the future, the visibility should be toggled by JS from the request type setting
res = client.get(