mirror of
https://github.com/simple-login/app.git
synced 2025-09-06 22:54:42 +08:00
Add test to use backup server
This commit is contained in:
parent
3c9b7582da
commit
3c8b5c8f5b
1 changed files with 16 additions and 0 deletions
|
@ -143,6 +143,22 @@ def test_mail_sender_try_several_servers():
|
|||
config.NOT_SEND_EMAIL = True
|
||||
|
||||
|
||||
def test_mail_sender_try_backup_postfix():
|
||||
port_closed = closed_dummy_server()
|
||||
port_ok = smtp_response_server("250 Ok")()
|
||||
original_postfix_server = config.POSTFIX_SERVERS
|
||||
config.POSTFIX_SERVERS = [f"localhost:{port_closed}"]
|
||||
config.POSTFIX_BACKUP_SERVERS = [f"localhost:{port_ok}"]
|
||||
config.NOT_SEND_EMAIL = False
|
||||
config.POSTFIX_SUBMISSION_TLS = False
|
||||
send_request = create_dummy_send_request()
|
||||
try:
|
||||
assert mail_sender.send(send_request, 0)
|
||||
finally:
|
||||
config.POSTFIX_SERVERS = original_postfix_server
|
||||
config.NOT_SEND_EMAIL = True
|
||||
|
||||
|
||||
@mail_sender.store_emails_test_decorator
|
||||
def test_send_unsent_email_from_fs():
|
||||
original_postfix_server = config.POSTFIX_SERVERS
|
||||
|
|
Loading…
Add table
Reference in a new issue