def test_mail_builder_to_conf(cf): conf, contact = cf conf.target = '*****@*****.**' c = ChloroformMailBuilder(conf) e = c.get_email(contact) assert e.to == ['*****@*****.**']
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 == '*****@*****.**'
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
def send_email(self, contact): cmb = ChloroformMailBuilder(self.object, request=self.request) email = cmb.get_email(contact) @on_commit def send_email(): email.send()
def test_mail_builder_metadata(cf): conf, contact = cf c = ChloroformMailBuilder(conf) context = c.get_context(contact) assert context['metadata'] == { 'nom': 'Albert', }
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
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
def test_mail_builder_from_default(cf): conf, contact = cf c = ChloroformMailBuilder(conf) e = c.get_email(contact) assert e.from_email == '*****@*****.**'