mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-12-12 11:05:42 +00:00
Test speedup - remove common calls for function calls (#3477)
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from flask import url_for
|
||||
from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks
|
||||
from .util import set_original_response, set_modified_response, live_server_setup, wait_for_all_checks, delete_all_watches
|
||||
from ..forms import REQUIRE_ATLEAST_ONE_TIME_PART_WHEN_NOT_GLOBAL_DEFAULT, REQUIRE_ATLEAST_ONE_TIME_PART_MESSAGE_DEFAULT
|
||||
|
||||
|
||||
def test_recheck_time_field_validation_global_settings(client, live_server):
|
||||
def test_recheck_time_field_validation_global_settings(client, live_server, measure_memory_usage):
|
||||
"""
|
||||
Tests that the global settings time field has atleast one value for week/day/hours/minute/seconds etc entered
|
||||
class globalSettingsRequestForm(Form):
|
||||
@@ -27,7 +27,7 @@ def test_recheck_time_field_validation_global_settings(client, live_server):
|
||||
assert REQUIRE_ATLEAST_ONE_TIME_PART_MESSAGE_DEFAULT.encode('utf-8') in res.data
|
||||
|
||||
|
||||
def test_recheck_time_field_validation_single_watch(client, live_server):
|
||||
def test_recheck_time_field_validation_single_watch(client, live_server, measure_memory_usage):
|
||||
"""
|
||||
Tests that the global settings time field has atleast one value for week/day/hours/minute/seconds etc entered
|
||||
class globalSettingsRequestForm(Form):
|
||||
@@ -36,13 +36,8 @@ def test_recheck_time_field_validation_single_watch(client, live_server):
|
||||
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
|
||||
uuid = client.application.config.get('DATASTORE').add_watch(url=test_url)
|
||||
client.get(url_for("ui.form_watch_checknow"), follow_redirects=True)
|
||||
|
||||
res = client.post(
|
||||
url_for("ui.ui_edit.edit_page", uuid="first"),
|
||||
@@ -100,7 +95,7 @@ def test_recheck_time_field_validation_single_watch(client, live_server):
|
||||
assert b"Updated watch." in res.data
|
||||
assert REQUIRE_ATLEAST_ONE_TIME_PART_WHEN_NOT_GLOBAL_DEFAULT.encode('utf-8') not in res.data
|
||||
|
||||
def test_checkbox_open_diff_in_new_tab(client, live_server):
|
||||
def test_checkbox_open_diff_in_new_tab(client, live_server, measure_memory_usage):
|
||||
|
||||
set_original_response()
|
||||
# Add our URL to the import page
|
||||
@@ -171,10 +166,9 @@ def test_checkbox_open_diff_in_new_tab(client, live_server):
|
||||
assert 'target=' not in target_line
|
||||
|
||||
# Cleanup everything
|
||||
res = client.get(url_for("ui.form_delete", uuid="all"), follow_redirects=True)
|
||||
assert b'Deleted' in res.data
|
||||
delete_all_watches(client)
|
||||
|
||||
def test_page_title_listing_behaviour(client, live_server):
|
||||
def test_page_title_listing_behaviour(client, live_server, measure_memory_usage):
|
||||
|
||||
set_original_response(extra_title="custom html")
|
||||
|
||||
@@ -249,7 +243,7 @@ def test_page_title_listing_behaviour(client, live_server):
|
||||
assert b"head titlecustom html" in res.data
|
||||
|
||||
|
||||
def test_ui_viewed_unread_flag(client, live_server):
|
||||
def test_ui_viewed_unread_flag(client, live_server, measure_memory_usage):
|
||||
|
||||
import time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user