Exemplo n.º 1
0
    def test_ok_form_creation(self):

        form_data = {"subject": "Test", "message": "This is a test", "sender": "*****@*****.**"}

        form = EventoForm(form_data)
        self.assertTrue(form.is_valid())
        self.assertTrue(form.is_bound)
        for chave, url in lista_de_urls.iteritems():
            url = reverse("evento")

        if form.is_valid():
            resp = self.client.post(url, form_data)
            self.assertEqual(resp.status_code, 302)
        else:
            self.assertEqual(resp.status_code, 404)
Exemplo n.º 2
0
    def test_bad_form_creation(self):

        form_data = {"subject": "Test", "message": "", "sender": "*****@*****.**"}

        form = EventoForm(form_data)
        self.assertFalse(form.is_valid())
        self.assertTrue(form.is_bound)
Exemplo n.º 3
0
    def test_is_unbound(self):

        form_data = {"subject": "", "message": "", "sender": ""}
        form = EventoForm(form_data)
        self.assertFalse(form.is_valid())