mirror of
https://github.com/simple-login/app.git
synced 2024-11-10 21:27:10 +01:00
Added test to create mailbox without sending an email
This commit is contained in:
parent
b0849bff6d
commit
ea138070fd
@ -70,8 +70,14 @@ def create_mailbox(
|
||||
if verified:
|
||||
LOG.i(f"User {user} as created a pre-verified mailbox with {email}")
|
||||
return new_mailbox
|
||||
|
||||
LOG.i(f"User {user} has created mailbox with {email}")
|
||||
activation = generate_activation_code(new_mailbox, use_digit_code=use_digit_codes)
|
||||
|
||||
if not send_email:
|
||||
LOG.i(f"Skipping sending validation email for mailbox {new_mailbox}")
|
||||
return new_mailbox
|
||||
|
||||
send_verification_email(
|
||||
user,
|
||||
new_mailbox,
|
||||
|
@ -101,6 +101,21 @@ def test_create_mailbox_with_digits():
|
||||
assert mail_sent.envelope_to == email
|
||||
|
||||
|
||||
@mail_sender.store_emails_test_decorator
|
||||
def test_create_mailbox_without_verification_email():
|
||||
email = random_email()
|
||||
mailbox_utils.create_mailbox(user, email, use_digit_codes=True, send_email=False)
|
||||
mailbox = Mailbox.get_by(email=email)
|
||||
assert mailbox is not None
|
||||
assert not mailbox.verified
|
||||
activation = MailboxActivation.get_by(mailbox_id=mailbox.id)
|
||||
assert activation is not None
|
||||
assert activation.tries == 0
|
||||
assert len(activation.code) == 6
|
||||
|
||||
assert 0 == len(mail_sender.get_stored_emails())
|
||||
|
||||
|
||||
@mail_sender.store_emails_test_decorator
|
||||
def test_send_verification_email():
|
||||
email = random_email()
|
||||
|
Loading…
Reference in New Issue
Block a user