def init_backend(self, options=None): """Use options to create a new mailer backend.""" options = get_config(options or {}) backend_path = options.pop('backend', None) backend_class = import_path(backend_path) if backend_class is None: raise RuntimeError("Invalid backend: '%s'" % backend_path) return backend_class(**options)
def test_get_config_trim_prefixes_from_config_keys(config): assert get_config(config) == { 'backend': 'flask_mailer.backends.dummy.DummyMailer', 'default_sender': 'webmaster', 'host': 'localhost', 'password': None, 'port': 25, 'testing': True, 'use_tls': False, 'username': None }
def test_get_config_convert_keys_to_lowercase(config): for key, value in get_config(config).items(): assert key.islower()