Example #1
0
    def test_create(self, org):
        tpl = EmailTemplate(organization=org,
                            type=TEMPLATE_RESET_PASSWORD,
                            subject='Custom subject',
                            template="""
            Custom template
            {{ password_reset_link }}
            """)
        tpl.save()

        updated = EmailTemplate.objects.get(organization=org,
                                            type=TEMPLATE_RESET_PASSWORD)
        assert updated.subject == tpl.subject
        assert updated.template == tpl.template
Example #2
0
def get_email_template():
    """
    Return the one and only EmailTemplate
    so it can be used in (Email templates)! *GASP*
    """
    email_template = EmailTemplate.get_instance()
    return email_template
Example #3
0
def get_email_template():
    """
    Return the one and only EmailTemplate
    so it can be used in (Email templates)! *GASP*
    """
    email_template = EmailTemplate.get_instance()
    return email_template
Example #4
0
 def test_create_fail_unique_constraint(self, org):
     tpl = EmailTemplate(organization=org,
                         type=TEMPLATE_RESET_PASSWORD,
                         subject='Custom subject',
                         template="""
         Custom template
         {{ password_reset_link }}
         """)
     tpl.save()
     tpl = EmailTemplate(organization=org,
                         type=TEMPLATE_RESET_PASSWORD,
                         subject='Another custom subject',
                         template="""
         Another custom template
         {{ password_reset_link }}
         """)
     with pytest.raises(IntegrityError):
         tpl.save()