mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
cleanup dead code, clarify others
This commit is contained in:
@@ -200,13 +200,6 @@ def is_valid_ipv4(address: str) -> bool:
|
||||
return False
|
||||
|
||||
|
||||
def format_arpa_address(address: str) -> str:
|
||||
if is_valid_ipv4(address):
|
||||
return ipaddress.IPv4Address(address).reverse_pointer
|
||||
DomainValidator().validate_domain_re(address)
|
||||
return address
|
||||
|
||||
|
||||
def format_mail_domain(raw_domain: str) -> str:
|
||||
if is_valid_ipv4(raw_domain):
|
||||
return f"[{raw_domain}]"
|
||||
|
||||
@@ -3,7 +3,6 @@ from contextlib import nullcontext as does_not_raise
|
||||
import pytest
|
||||
|
||||
from chatmaild.config import (
|
||||
format_arpa_address,
|
||||
format_mail_domain,
|
||||
is_valid_ipv4,
|
||||
parse_size_mb,
|
||||
@@ -165,20 +164,6 @@ def test_is_valid_ipv4(input, result):
|
||||
assert result == is_valid_ipv4(input)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["input", "result", "exception"],
|
||||
[
|
||||
("example.org", "example.org", does_not_raise()),
|
||||
("1.3.3.7", "7.3.3.1.in-addr.arpa", does_not_raise()),
|
||||
("fe::1", None, pytest.raises(ValueError)),
|
||||
("12394142", None, pytest.raises(ValueError)),
|
||||
],
|
||||
)
|
||||
def test_format_arpa_address(input, result, exception):
|
||||
with exception:
|
||||
assert result == format_arpa_address(input)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
["input", "result", "exception"],
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user