mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 15:23:27 +08:00
rename parse_email_log_id_from_bounce -> parse_id_from_bounce
This commit is contained in:
parent
fcc04ba929
commit
4a91db8e11
3 changed files with 7 additions and 7 deletions
|
@ -970,5 +970,5 @@ def should_disable(alias: Alias) -> bool:
|
|||
return False
|
||||
|
||||
|
||||
def parse_email_log_id_from_bounce(email_address: str) -> int:
|
||||
def parse_id_from_bounce(email_address: str) -> int:
|
||||
return int(email_address[email_address.find("+") : email_address.rfind("+")])
|
||||
|
|
|
@ -109,7 +109,7 @@ from app.email_utils import (
|
|||
is_valid_email,
|
||||
replace,
|
||||
should_disable,
|
||||
parse_email_log_id_from_bounce,
|
||||
parse_id_from_bounce,
|
||||
)
|
||||
from app.extensions import db
|
||||
from app.greylisting import greylisting_needed
|
||||
|
@ -1593,7 +1593,7 @@ def handle_bounce(envelope, rcpt_to) -> str:
|
|||
msg = email.message_from_bytes(envelope.original_content)
|
||||
|
||||
# parse the EmailLog
|
||||
email_log_id = parse_email_log_id_from_bounce(rcpt_to)
|
||||
email_log_id = parse_id_from_bounce(rcpt_to)
|
||||
email_log = EmailLog.get(email_log_id)
|
||||
|
||||
if not email_log:
|
||||
|
|
|
@ -26,7 +26,7 @@ from app.email_utils import (
|
|||
replace,
|
||||
should_disable,
|
||||
decode_text,
|
||||
parse_email_log_id_from_bounce,
|
||||
parse_id_from_bounce,
|
||||
)
|
||||
from app.extensions import db
|
||||
from app.models import User, CustomDomain, Alias, Contact, EmailLog
|
||||
|
@ -652,6 +652,6 @@ def test_should_disable_bounce_consecutive_days(flask_client):
|
|||
assert should_disable(alias)
|
||||
|
||||
|
||||
def test_parse_email_log_id_from_bounce():
|
||||
assert parse_email_log_id_from_bounce("bounces+1234+@local") == 1234
|
||||
assert parse_email_log_id_from_bounce(BOUNCE_EMAIL.format(1234)) == 1234
|
||||
def test_parse_id_from_bounce():
|
||||
assert parse_id_from_bounce("bounces+1234+@local") == 1234
|
||||
assert parse_id_from_bounce(BOUNCE_EMAIL.format(1234)) == 1234
|
||||
|
|
Loading…
Reference in a new issue