4.46.0
All checks were successful
Build-Release-Image / Build-Image (linux/amd64) (push) Successful in 3m41s
Build-Release-Image / Build-Image (linux/arm64) (push) Successful in 4m54s
Build-Release-Image / Merge-Images (push) Successful in 19s
Build-Release-Image / Create-Release (push) Successful in 16s
Build-Release-Image / Notify (push) Successful in 19s
All checks were successful
Build-Release-Image / Build-Image (linux/amd64) (push) Successful in 3m41s
Build-Release-Image / Build-Image (linux/arm64) (push) Successful in 4m54s
Build-Release-Image / Merge-Images (push) Successful in 19s
Build-Release-Image / Create-Release (push) Successful in 16s
Build-Release-Image / Notify (push) Successful in 19s
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
from app.db import Session
|
||||
from app.models import Alias, Mailbox, AliasMailbox
|
||||
from app.models import Alias, Mailbox, AliasMailbox, User
|
||||
from tests.utils import create_new_user, random_email
|
||||
|
||||
|
||||
@ -15,3 +15,17 @@ def test_duplicated_mailbox_is_returned_only_once():
|
||||
alias_mailbox_id = [mailbox.id for mailbox in alias_mailboxes]
|
||||
assert user.default_mailbox_id in alias_mailbox_id
|
||||
assert other_mailbox.id in alias_mailbox_id
|
||||
|
||||
|
||||
def test_alias_create_from_partner_flags_also_the_user():
|
||||
user = create_new_user()
|
||||
Session.flush()
|
||||
email = random_email()
|
||||
alias = Alias.create(
|
||||
user_id=user.id,
|
||||
email=email,
|
||||
mailbox_id=user.default_mailbox_id,
|
||||
flags=Alias.FLAG_PARTNER_CREATED,
|
||||
flush=True,
|
||||
)
|
||||
assert alias.user.flags & User.FLAG_CREATED_ALIAS_FROM_PARTNER > 0
|
||||
|
@ -9,6 +9,7 @@ import pytest
|
||||
from app import config
|
||||
from app.config import MAX_ALERT_24H, ROOT_DIR
|
||||
from app.db import Session
|
||||
from app.email import headers
|
||||
from app.email_utils import (
|
||||
get_email_domain_part,
|
||||
can_create_directory_for_address,
|
||||
@ -354,6 +355,33 @@ def test_is_valid_email():
|
||||
assert not is_valid_email("emoji👌@gmail.com")
|
||||
|
||||
|
||||
def test_add_subject_prefix():
|
||||
msg = email.message_from_string(
|
||||
"""Subject: Potato
|
||||
Content-Transfer-Encoding: 7bit
|
||||
|
||||
hello
|
||||
"""
|
||||
)
|
||||
new_msg = add_header(msg, "text header", "html header", subject_prefix="[TEST]")
|
||||
assert "text header" in new_msg.as_string()
|
||||
assert "html header" not in new_msg.as_string()
|
||||
assert new_msg[headers.SUBJECT] == "[TEST] Potato"
|
||||
|
||||
|
||||
def test_add_subject_prefix_with_no_header():
|
||||
msg = email.message_from_string(
|
||||
"""Content-Transfer-Encoding: 7bit
|
||||
|
||||
hello
|
||||
"""
|
||||
)
|
||||
new_msg = add_header(msg, "text header", "html header", subject_prefix="[TEST]")
|
||||
assert "text header" in new_msg.as_string()
|
||||
assert "html header" not in new_msg.as_string()
|
||||
assert new_msg[headers.SUBJECT] == "[TEST]"
|
||||
|
||||
|
||||
def test_add_header_plain_text():
|
||||
msg = email.message_from_string(
|
||||
"""Content-Type: text/plain; charset=us-ascii
|
||||
|
Reference in New Issue
Block a user