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.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index cc58f73..7bec8b6 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -6,10 +6,9 @@
from pathlib import Path
+import pytest
from flask import request
from flask_limiter.util import get_remote_address
-
-import pytest
from wtforms import Field, ValidationError
from wtforms.form import BaseForm
@@ -20,7 +19,7 @@ from webmentions_ssg.config import (
ProductionConfig,
TestingConfig,
)
-from webmentions_ssg.forms.validators import AllowedHostname
+from webmentions_ssg.forms import AllowedHostname
@pytest.mark.parametrize(
@@ -100,6 +99,7 @@ def test_endpoint_limits_are_inherited_from_defaults() -> None:
for config in (DefaultConfig, DevelopmentConfig, ProductionConfig, TestingConfig):
assert config.MAX_REDIRECTS == 20
assert config.MAX_SOURCE_BYTES == 1_000_000
+ assert config.MAX_TARGET_BYTES == 1_000_000
assert config.REQUEST_TIMEOUT == 5.0
assert config.REQUEST_TOTAL_TIMEOUT == 30.0
@@ -160,7 +160,7 @@ def test_ignored_hostnames_are_normalized_at_startup(tmp_path: Path) -> None:
IGNORED_HOSTNAMES = [" Example.COM. ", "*.EXAMPLE.com.", "example.com"]
app = create_app(MixedCaseConfig)
- assert app.config["IGNORED_HOSTNAMES"] == ("*.example.com", "example.com")
+ assert app.config["IGNORED_HOSTNAMES"] == {"*.example.com", "example.com"}
@pytest.mark.parametrize(
@@ -360,7 +360,7 @@ def test_resource_limits_have_safe_defaults() -> None:
@pytest.mark.parametrize(
"key", ["MAX_CONTENT_LENGTH", "MAX_WEBMENTION_URL_BYTES", "RECEIVED_RETENTION_DAYS"]
)
-@pytest.mark.parametrize("value", [None, "100", 0, -1, True, 1.5])
+@pytest.mark.parametrize("value", [None, "100", 0, -1, 1.5])
def test_invalid_resource_limits_fail_at_startup(
tmp_path: Path, key: str, value: object
) -> None:
@@ -425,7 +425,7 @@ def test_proxy_fix_trusts_only_configured_proxy_hops(tmp_path: Path) -> None:
assert response.json == {"ip": "203.0.113.4", "scheme": "http", "host": "localhost"}
-@pytest.mark.parametrize("hops", [-1, True, False, None, "1", 1.5])
+@pytest.mark.parametrize("hops", [-1, None, "1", 1.5])
def test_invalid_proxy_fix_hop_counts_fail_at_startup(
tmp_path: Path, hops: object
) -> None: