mirror of
https://github.com/simple-login/app.git
synced 2024-11-15 05:07:33 +08:00
fix: missing branch on get_alias_recipient_name (#2254)
* fix: missing branch on get_alias_recipient_name * test: add test for missing else branch
This commit is contained in:
parent
5bc72f92d4
commit
b269ce81e6
2 changed files with 20 additions and 2 deletions
|
@ -569,5 +569,4 @@ def get_alias_recipient_name(alias: Alias) -> AliasRecipientName:
|
|||
name=sl_formataddr((alias.custom_domain.name, alias.email)),
|
||||
message=f"Put domain default alias name {alias.custom_domain.name} in from header",
|
||||
)
|
||||
else:
|
||||
return AliasRecipientName(name=alias.email)
|
||||
return AliasRecipientName(name=alias.email)
|
||||
|
|
|
@ -184,6 +184,25 @@ def test_get_alias_recipient_alias_with_name_and_custom_domain_name():
|
|||
assert res.name == f"{alias.name} <{alias.email}>"
|
||||
|
||||
|
||||
def test_get_alias_recipient_alias_without_name_and_custom_domain_without_name():
|
||||
user = create_new_user()
|
||||
custom_domain = CustomDomain.create(
|
||||
user_id=user.id,
|
||||
domain=random_domain(),
|
||||
verified=True,
|
||||
)
|
||||
alias = Alias.create(
|
||||
user_id=user.id,
|
||||
email=random_email(),
|
||||
mailbox_id=user.default_mailbox_id,
|
||||
custom_domain_id=custom_domain.id,
|
||||
commit=True,
|
||||
)
|
||||
res = get_alias_recipient_name(alias)
|
||||
assert res.message is None
|
||||
assert res.name == alias.email
|
||||
|
||||
|
||||
def test_get_alias_recipient_alias_without_name_and_custom_domain_name():
|
||||
user = create_new_user()
|
||||
custom_domain = CustomDomain.create(
|
||||
|
|
Loading…
Reference in a new issue