Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing branch on get_alias_recipient_name #2254

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/alias_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
19 changes: 19 additions & 0 deletions tests/test_alias_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading