Files
changedetection.io/changedetectionio/tests/test_clone.py
dgtlmoon c7ffebce2a
Some checks are pending
Build and push containers / metadata (push) Waiting to run
Build and push containers / build-push-containers (push) Waiting to run
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Waiting to run
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Test the built 📦 package works basically. (push) Blocked by required conditions
Publish Python 🐍distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Blocked by required conditions
ChangeDetection.io App Test / lint-code (push) Waiting to run
ChangeDetection.io App Test / test-application-3-10 (push) Blocked by required conditions
ChangeDetection.io App Test / test-application-3-11 (push) Blocked by required conditions
ChangeDetection.io App Test / test-application-3-12 (push) Blocked by required conditions
ChangeDetection.io App Test / test-application-3-13 (push) Blocked by required conditions
UI - Watch edit - "Clone" Should be "Clone & Edit" without watch history, redirect to the new edit page (#3063 #2782)
2025-03-27 11:24:42 +01:00

41 lines
1.1 KiB
Python

#!/usr/bin/env python3
import time
from flask import url_for
from .util import live_server_setup, wait_for_all_checks
def test_clone_functionality(client, live_server, measure_memory_usage):
live_server_setup(live_server)
with open("test-datastore/endpoint-content.txt", "w") as f:
f.write("<html><body>Some content</body></html>")
test_url = url_for('test_endpoint', _external=True)
# Add our URL to the import page
res = client.post(
url_for("imports.import_page"),
data={"urls": test_url},
follow_redirects=True
)
assert b"1 Imported" in res.data
wait_for_all_checks(client)
# So that we can be sure the same history doesnt carry over
time.sleep(1)
res = client.get(
url_for("ui.form_clone", uuid="first"),
follow_redirects=True
)
existing_uuids = set()
for uuid, watch in live_server.app.config['DATASTORE'].data['watching'].items():
new_uuids = set(watch.history.keys())
duplicates = existing_uuids.intersection(new_uuids)
assert len(duplicates) == 0
existing_uuids.update(new_uuids)
assert b"Cloned" in res.data