aboutsummaryrefslogtreecommitdiff
path: root/tests/test_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_config.py')
-rw-r--r--tests/test_config.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index a4c5e9b..d075e7d 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -354,11 +354,18 @@ def test_resource_limits_have_safe_defaults() -> None:
assert DefaultConfig.MAX_CONTENT_LENGTH == 64 * 1024
assert DefaultConfig.MAX_WEBMENTION_URL_BYTES == 8192
assert DefaultConfig.RECEIVED_RETENTION_DAYS == 30
+ assert DefaultConfig.RECEIVED_MAX_PAGE_SIZE == 100
assert DefaultConfig.RECEIVED_RETENTION_SCHEDULE == "0 3 * * *"
@pytest.mark.parametrize(
- "key", ["MAX_CONTENT_LENGTH", "MAX_WEBMENTION_URL_BYTES", "RECEIVED_RETENTION_DAYS"]
+ "key",
+ [
+ "MAX_CONTENT_LENGTH",
+ "MAX_WEBMENTION_URL_BYTES",
+ "RECEIVED_RETENTION_DAYS",
+ "RECEIVED_MAX_PAGE_SIZE",
+ ],
)
@pytest.mark.parametrize("value", [None, "100", 0, -1, 1.5])
def test_invalid_resource_limits_fail_at_startup(
@@ -372,6 +379,18 @@ def test_invalid_resource_limits_fail_at_startup(
create_app(InvalidResourceLimit)
+def test_received_max_page_size_can_be_set_in_cfg(tmp_path: Path) -> None:
+ config_file = tmp_path / "development.cfg"
+ config_file.write_text("RECEIVED_MAX_PAGE_SIZE = 250\n")
+
+ class ConfiguredDevelopment(DevelopmentConfig):
+ CONFIG_FILE = str(config_file)
+ LOG_FILE = str(tmp_path / "development.log")
+
+ app = create_app(ConfiguredDevelopment)
+ assert app.config["RECEIVED_MAX_PAGE_SIZE"] == 250
+
+
def test_proxy_fix_disabled_by_default(tmp_path: Path) -> None:
class DirectConfig(TestingConfig):
LOG_FILE = str(tmp_path / "direct.log")