def test_create_email_html_template_with_cc(self): res = create_confirmation_email_dict( self.response, dict(CONFIRMATION_EMAIL_INFO_TEMPLATE, cc="*****@*****.**"), ) self.assertEqual( res, dict(EXPECTED_RES_TEMPLATE, ccEmail="*****@*****.**"))
def test_email_html_template_true_false(self): # todo fix template = "<div style='width: 100%;background-color: #eee; margin: 10px 0px;'> <div style='width: 80%;margin: auto; box-shadow: 1px 1px 4px grey;padding: 10px 30px;background: white;'> <img src='https://d1dyr7ljeznkdv.cloudfront.net/cff.chinmayamission.com/Ramdoot%20banner.png' width='100%'> <div style='float: left'> CHINMAYA RAMDOOT CMTC </div> <div style='float: left'> Tax ID: </div> <br style='clear: both'> <br> <br> <br> Hari OM,<br><br> Thank you for supporting Chinmaya Ramdoot with your generous donation. <table style='border: 1px solid black; margin: 10px; padding: 10px;'> <tr> <td>CMTC<br>Chinmaya Ramdoot</td> <td>{{paymentInfo.total | format_payment(paymentInfo.currency)}} {% if value['Pariwar'] %}(monthly donation){% endif %} </td> </tr> </table> <br> <br> With Prem & OM,<br> Ramdoot Sevaks </div> </div>" confirmationEmailInfo = dict(CONFIRMATION_EMAIL_INFO_TEMPLATE, template={"html": template}) res = create_confirmation_email_dict(self.response, confirmationEmailInfo)
def test_create_email_html_template_with_invalid_toField(self): res = create_confirmation_email_dict( self.response, dict(CONFIRMATION_EMAIL_INFO_TEMPLATE, toField=["email", "invalidpath"]), ) self.assertEqual(res["toEmail"], ["*****@*****.**"])
def test_create_email_html_template_with_undefined(self): confirmationEmailInfo = dict( CONFIRMATION_EMAIL_INFO_TEMPLATE, template={"html": "Hello world. {{undef}}{{undef.undef}}Hohoho."}, ) res = create_confirmation_email_dict(self.response, confirmationEmailInfo) self.assertEqual( res, dict(EXPECTED_RES_TEMPLATE, msgBody="Hello world. Hohoho."))
def test_create_email_html_template_format_payment_filter_with_undefined( self): confirmationEmailInfo = dict( CONFIRMATION_EMAIL_INFO_TEMPLATE, template={ "html": "Hello world. {{ahuahu.total | format_payment(ahiahi.currency)}} Hohoho." }, ) res = create_confirmation_email_dict(self.response, confirmationEmailInfo) self.assertEqual( res, dict(EXPECTED_RES_TEMPLATE, msgBody="Hello world. Hohoho."))
def test_create_email_html_template_with_hardcoded_to(self): res = create_confirmation_email_dict( self.response, dict(CONFIRMATION_EMAIL_INFO_TEMPLATE, to=[ "*****@*****.**", "*****@*****.**", "*****@*****.**" ]), ) self.assertEqual(res["toEmail"], [ "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**" ])
def test_create_email_html_template(self): res = create_confirmation_email_dict(self.response, CONFIRMATION_EMAIL_INFO_TEMPLATE) self.assertEqual(res, EXPECTED_RES_TEMPLATE)