Пример #1
0
def test_email_template_loading():
    expected = "<html><body>Hello Django</body></html>"
    emails = load_email_templates(['email/test_tramitacao.html'],
                                  context={"name": "Django"})

    # strip \n and \r to compare with expected
    actual = emails[0].replace('\n', '').replace('\r', '')

    assert actual == expected
Пример #2
0
def test_html_email_body_with_materia():
    templates = load_email_templates(['email/tramitacao.txt',
                                      'email/tramitacao.html'],
                                     {"image": 'img/logo.png',
                                      "casa_legislativa":
                                         "Assembléia Parlamentar",
                                      "data_registro": "25/02/2016",
                                      "cod_materia": "1",
                                      "descricao_materia": "Ementa de teste",
                                      "autoria": ["Autor1", "Autor2"],
                                      "data": "25/02/2016",
                                      "status": "Arquivado",
                                      "texto_acao": "Deliberado",
                                      "hash_txt": "abc01f",
                                      "materia_id": "794",
                                      "base_url": "http://localhost:8000",
                                      "materia_url":
                                         "/materia/764/acompanhar-materia",
                                      "excluir_url":
                                         "/materia/764/acompanhar-excluir"})

    assert len(templates) == 2