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)
Beispiel #2
0
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 }
Beispiel #3
0
    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)
Beispiel #4
0
def test_get_config_convert_keys_to_lowercase(config):
    for key, value in get_config(config).items():
        assert key.islower()