Exemple #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 == ['*****@*****.**']
Exemple #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 == '*****@*****.**'
Exemple #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
Exemple #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()
Exemple #5
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
Exemple #6
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
Exemple #7
0
def test_mail_builder_from_default(cf):
    conf, contact = cf
    c = ChloroformMailBuilder(conf)
    e = c.get_email(contact)

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