From f68cfa19122d9a25483d684af8634da14455bfb7 Mon Sep 17 00:00:00 2001 From: Eduardo Calil Date: Mon, 5 Sep 2016 09:28:54 -0300 Subject: [PATCH] Resolve problemas nos testes --- sapl/materia/forms.py | 10 +++++++--- sapl/materia/tests/test_materia.py | 2 ++ sapl/materia/views.py | 6 +++--- sapl/protocoloadm/tests/test_protocoloadm.py | 1 + 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sapl/materia/forms.py b/sapl/materia/forms.py index 53549e822..851dd51ba 100644 --- a/sapl/materia/forms.py +++ b/sapl/materia/forms.py @@ -216,9 +216,13 @@ class TramitacaoForm(ModelForm): 'texto'] def clean(self): - data_enc_form = self.cleaned_data['data_encaminhamento'] - data_prazo_form = self.cleaned_data['data_fim_prazo'] - data_tram_form = self.cleaned_data['data_tramitacao'] + + if 'data_encaminhamento' in self.data: + data_enc_form = self.cleaned_data['data_encaminhamento'] + if 'data_fim_prazo' in self.data: + data_prazo_form = self.cleaned_data['data_fim_prazo'] + if 'data_tramitacao' in self.data: + data_tram_form = self.cleaned_data['data_tramitacao'] if self.errors: return self.errors diff --git a/sapl/materia/tests/test_materia.py b/sapl/materia/tests/test_materia.py index f400a453e..d3a9573c9 100644 --- a/sapl/materia/tests/test_materia.py +++ b/sapl/materia/tests/test_materia.py @@ -276,6 +276,8 @@ def test_tramitacao_submit(admin_client): 'urgente': True, 'status': status_tramitacao.pk, 'data_tramitacao': '2016-03-21', + 'data_fim_prazo': '2016-03-22', + 'data_encaminhamento': '2016-03-22', 'texto': 'Texto_Teste', 'salvar': 'salvar'}, follow=True) diff --git a/sapl/materia/views.py b/sapl/materia/views.py index f4b76dfea..239384030 100644 --- a/sapl/materia/views.py +++ b/sapl/materia/views.py @@ -37,9 +37,9 @@ from .forms import (AcompanhamentoMateriaForm, AnexadaForm, AutorForm, AutoriaForm, ConfirmarProposicaoForm, DespachoInicialForm, DocumentoAcessorioForm, LegislacaoCitadaForm, MateriaLegislativaFilterSet, NumeracaoForm, ProposicaoForm, - ReceberProposicaoForm, RelatoriaForm, - TramitacaoForm, TramitacaoUpdateForm, - UnidadeTramitacaoForm, filtra_tramitacao_destino, + ReceberProposicaoForm, RelatoriaForm, TramitacaoForm, + TramitacaoUpdateForm, UnidadeTramitacaoForm, + filtra_tramitacao_destino, filtra_tramitacao_destino_and_status, filtra_tramitacao_status) from .models import (AcompanhamentoMateria, Anexada, Autor, Autoria, diff --git a/sapl/protocoloadm/tests/test_protocoloadm.py b/sapl/protocoloadm/tests/test_protocoloadm.py index 6f9e0ad19..e249a3312 100644 --- a/sapl/protocoloadm/tests/test_protocoloadm.py +++ b/sapl/protocoloadm/tests/test_protocoloadm.py @@ -1,4 +1,5 @@ import datetime + import pytest from django.core.urlresolvers import reverse from django.utils.translation import ugettext_lazy as _