summaryrefslogtreecommitdiff
path: root/tests/validators
diff options
context:
space:
mode:
authorJustin Thurman <justin.thurman@bevy.com>2024-10-16 09:43:02 -0400
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-10-17 17:00:35 +0200
commit3ba8b0dae8cfa8609a525a100ccc7d88859c5c81 (patch)
tree3b7cd4524b8ba053d9936e3c0e1fe51f7e8dd358 /tests/validators
parent9a5eae0ad8054e9e9d8a43505c52313eecddbc8e (diff)
[5.1.x] Fixed #35845 -- Updated DomainNameValidator to require entire string to be a valid domain name.
Bug in 4971a9afe5642569f3dcfcd3972ebb39e88dd457. Thank you to kazet for the report and Claude Paroz for the review. Backport of 99dcc59237f384d7ade98acfd1cae8d90e6d60ab from main.
Diffstat (limited to 'tests/validators')
-rw-r--r--tests/validators/tests.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/validators/tests.py b/tests/validators/tests.py
index ba1db5ea46..4ae0f6413e 100644
--- a/tests/validators/tests.py
+++ b/tests/validators/tests.py
@@ -635,8 +635,8 @@ TEST_DATA = [
(validate_domain_name, "python-python.com", None),
(validate_domain_name, "python.name.uk", None),
(validate_domain_name, "python.tips", None),
- (validate_domain_name, "http://例子.测试", None),
- (validate_domain_name, "http://dashinpunytld.xn---c", None),
+ (validate_domain_name, "例子.测试", None),
+ (validate_domain_name, "dashinpunytld.xn---c", None),
(validate_domain_name, "python..org", ValidationError),
(validate_domain_name, "python-.org", ValidationError),
(validate_domain_name, "too-long-name." * 20 + "com", ValidationError),
@@ -652,6 +652,16 @@ TEST_DATA = [
),
(DomainNameValidator(accept_idna=False), "ıçğü.com", ValidationError),
(DomainNameValidator(accept_idna=False), "not-domain-name", ValidationError),
+ (
+ DomainNameValidator(accept_idna=False),
+ "not-domain-name, but-has-domain-name-suffix.com",
+ ValidationError,
+ ),
+ (
+ DomainNameValidator(accept_idna=False),
+ "not-domain-name.com, but has domain prefix",
+ ValidationError,
+ ),
]
# Add valid and invalid URL tests.