test_send.py 559 B

123456789101112131415161718
  1. import pytest
  2. from redmail import EmailSender, send_email
  3. def test_send():
  4. email = EmailSender(host="localhost", port=0)
  5. # This should fail but we test everything else goes through
  6. with pytest.raises(ConnectionRefusedError):
  7. email.send(
  8. subject="An example",
  9. receivers=['koli.mikael@example.com']
  10. )
  11. def test_send_function():
  12. # This should fail but we test everything else goes through
  13. with pytest.raises(ConnectionRefusedError):
  14. send_email(host="localhost", port=0, subject="An example")