@@ -0,0 +1,1811 @@
+%22%22%22%0A:Copyright: 2006-2020 Jochen Kupperschmidt%0A:License: Revised BSD (see %60LICENSE%60 file for details)%0A%22%22%22%0A%0Afrom flask import Flask%0A%0Afrom byceps.email import _get_config%0A%0A%0Adef test_get_config_with_defaults():%0A    app = Flask(__name__)%0A%0A    actual = _get_config(app)%0A%0A    assert actual == %7B%0A        'transport.use': 'smtp',%0A        'transport.host': 'localhost',%0A        'transport.port': 25,%0A        'transport.debug': False,%0A        'message.author': None,%0A    %7D%0A%0A%0Adef test_get_config_with_custom_values():%0A    app = Flask(__name__)%0A    app.config.update(%7B%0A        'MAIL_SERVER': 'mail.server.example',%0A        'MAIL_PORT': 2525,%0A        'MAIL_DEBUG': True,%0A        'MAIL_DEFAULT_SENDER': 'Mailer %3Cnoreply@server.example%3E',%0A        'MAIL_USERNAME': 'paperboy',%0A        'MAIL_PASSWORD': 'secret!',%0A    %7D)%0A%0A    actual = _get_config(app)%0A%0A    assert actual == %7B%0A        'transport.use': 'smtp',%0A        'transport.host': 'mail.server.example',%0A        'transport.port': 2525,%0A        'transport.debug': True,%0A        'transport.username': 'paperboy',%0A        'transport.password': 'secret!',%0A        'message.author': 'Mailer %3Cnoreply@server.example%3E',%0A    %7D%0A%0A%0Adef test_get_config_with_ssl():%0A    app = Flask(__name__)%0A    app.config%5B'MAIL_USE_SSL'%5D = True%0A%0A    actual = _get_config(app)%0A%0A    assert actual%5B'transport.tls'%5D == 'ssl'%0A%0A%0Adef test_get_config_with_tls():%0A    app = Flask(__name__)%0A    app.config%5B'MAIL_USE_TLS'%5D = True%0A%0A    actual = _get_config(app)%0A%0A    assert actual%5B'transport.tls'%5D == 'required'%0A%0A%0Adef test_get_config_with_ssl_and_tls():%0A    # Can only be set to SSL or TLS.%0A    # If both are requested, TLS wins.%0A%0A    app = Flask(__name__)%0A    app.config%5B'MAIL_USE_SSL'%5D = True%0A    app.config%5B'MAIL_USE_TLS'%5D = True%0A%0A    actual = _get_config(app)%0A%0A    assert actual%5B'transport.tls'%5D == 'required'%0A

Test email configuration