Ejemplo n.º 1
0
def enviar_email(request):
    if request.method == 'POST':
        form = FormContato(request.POST)
        email_list = request.POST.get('email')
        texto = request.POST.get('texto')
        status = form.enviar(email_list, texto)
        if status:
            return render_to_response('sucesso.html', locals(), context_instance=RequestContext(request, {}))
    else:
        form = FormContato()
        return render_to_response('contato.html', locals(), context_instance=RequestContext(request, {}))
Ejemplo n.º 2
0
class FormContatoTestCase(unittest.TestCase):

    def test_should_send_email(self):
        self.form = FormContato()
        email_list = "*****@*****.**"
        texto = "Ola colaboradores"
        status = self.form.enviar(email_list, texto)
        self.assertTrue(status)