Example #1
0
def test_mail_builder_to_conf(cf):
    conf, contact = cf
    conf.target = '*****@*****.**'
    c = ChloroformMailBuilder(conf)
    e = c.get_email(contact)

    assert e.to == ['*****@*****.**']
Example #2
0
def test_mail_builder_from_conf(settings, cf):
    settings.CHLOROFORM_FROM_EMAIL = '*****@*****.**'
    conf, contact = cf
    c = ChloroformMailBuilder(conf)
    e = c.get_email(contact)

    assert e.from_email == '*****@*****.**'
Example #3
0
def test_mail_builder(cf):
    conf, contact = cf
    c = ChloroformMailBuilder(conf)
    e = c.get_email(contact)

    assert 'mark02' in e.body
    assert 'https://chloroform.emencia.net' in e.body
Example #4
0
    def send_email(self, contact):
        cmb = ChloroformMailBuilder(self.object, request=self.request)
        email = cmb.get_email(contact)

        @on_commit
        def send_email():
            email.send()
Example #5
0
def test_mail_builder_metadata(cf):
    conf, contact = cf
    c = ChloroformMailBuilder(conf)
    context = c.get_context(contact)

    assert context['metadata'] == {
        'nom': 'Albert',
    }
Example #6
0
def test_mail_builder_alternative_template(cf):
    conf, contact = cf
    conf.name = 'alternative'
    c = ChloroformMailBuilder(conf)
    e = c.get_email(contact)

    assert 'mark01' in e.body
    assert 'https://chloroform.emencia.net' in e.body
Example #7
0
def test_mail_builder_request(cf, rf):
    conf, contact = cf
    c = ChloroformMailBuilder(conf, request=rf.get('/',
                                                   SERVER_NAME='chloroform.emencia.org'))
    e = c.get_email(contact)

    assert 'mark02' in e.body
    assert 'http://chloroform.emencia.org' in e.body
Example #8
0
def test_mail_builder_from_default(cf):
    conf, contact = cf
    c = ChloroformMailBuilder(conf)
    e = c.get_email(contact)

    assert e.from_email == '*****@*****.**'