tests: route SMTP IDNA fixture directly
This commit is contained in:
@@ -281,7 +281,6 @@ def perform_test() -> None:
|
||||
|
||||
original_smtp = read_configuration("smtp")
|
||||
original_queue = read_configuration("queue")
|
||||
original_aliases = read_configuration("aliases/bongo.test")
|
||||
original_global = read_configuration("global")
|
||||
all_configurations = {
|
||||
name: read_configuration(name)
|
||||
@@ -316,12 +315,6 @@ def perform_test() -> None:
|
||||
test_queue["queueinterval"] = 1
|
||||
test_queue["retry_initial_seconds"] = 2
|
||||
test_queue["retry_maximum_seconds"] = 4
|
||||
test_aliases = copy.deepcopy(original_aliases)
|
||||
aliases = test_aliases.setdefault("aliases", {})
|
||||
if not isinstance(aliases, dict) or TOKEN in aliases:
|
||||
raise SMTP26Error("temporary alias cannot be installed safely")
|
||||
aliases[TOKEN] = f"capture@{REMOTE_UNICODE_DOMAIN}"
|
||||
|
||||
resolver_metadata = SMTP07.regular_file_metadata(SMTP07.RESOLV_CONF)
|
||||
original_resolver = SMTP07.RESOLV_CONF.read_bytes()
|
||||
upstream = SMTP07.original_nameserver(original_resolver)
|
||||
@@ -344,9 +337,8 @@ def perform_test() -> None:
|
||||
signal.signal(signal.SIGHUP, terminate)
|
||||
try:
|
||||
replace_configuration("smtp", test_smtp)
|
||||
replace_configuration("queue", test_queue)
|
||||
replace_configuration("aliases/bongo.test", test_aliases)
|
||||
configs_changed = True
|
||||
replace_configuration("queue", test_queue)
|
||||
SMTP07.run([SMTP07.SYSTEMCTL, "stop", "bongo.service"])
|
||||
SMTP07.save_resolver(original_resolver)
|
||||
SMTP07.atomic_write(
|
||||
@@ -393,7 +385,8 @@ def perform_test() -> None:
|
||||
|
||||
smtp_submit(
|
||||
internal_host, internal_port,
|
||||
f"{TOKEN}@bongo.test", direct_marker, smtputf8=False,
|
||||
f"capture@{REMOTE_UNICODE_DOMAIN}", direct_marker,
|
||||
smtputf8=True,
|
||||
)
|
||||
_mail, rcpt, _data = wait_capture(
|
||||
direct_marker,
|
||||
@@ -461,7 +454,6 @@ def perform_test() -> None:
|
||||
restoration_errors.append(f"message cleanup failed: {error}")
|
||||
if configs_changed:
|
||||
for name, value in (
|
||||
("aliases/bongo.test", original_aliases),
|
||||
("queue", original_queue),
|
||||
("smtp", original_smtp),
|
||||
):
|
||||
@@ -504,15 +496,13 @@ def perform_test() -> None:
|
||||
raise SMTP26Error("SMTP configuration was not restored exactly")
|
||||
if read_configuration("queue") != original_queue:
|
||||
raise SMTP26Error("Queue configuration was not restored exactly")
|
||||
if read_configuration("aliases/bongo.test") != original_aliases:
|
||||
raise SMTP26Error("alias configuration was not restored exactly")
|
||||
if SMTP07.RESOLV_CONF.read_bytes() != original_resolver:
|
||||
raise SMTP26Error("resolver configuration was not restored exactly")
|
||||
print(
|
||||
"SMTP-26 PASS "
|
||||
"idna=idna2008/nontransitional "
|
||||
"config=hostname/hosted/relay/lmtp "
|
||||
"aliases=unicode-target/alabel-route "
|
||||
"routing=unicode-recipient/alabel-envelope "
|
||||
"inbound=unicode-smtputf8/alabel-ascii "
|
||||
"invalid-alabel=501 "
|
||||
"dns=alabel-mx/relay "
|
||||
|
||||
Reference in New Issue
Block a user