mirror of https://github.com/interlegis/sapl.git
12 changed files with 174 additions and 26 deletions
@ -0,0 +1,35 @@ |
|||
import pytest |
|||
from django.core.urlresolvers import reverse |
|||
from django.utils.translation import ugettext_lazy as _ |
|||
|
|||
|
|||
@pytest.mark.django_db(transaction=False) |
|||
def test_incluir_casa_legislativa_errors(admin_client): |
|||
|
|||
response = admin_client.post(reverse('sapl.base:casalegislativa_create'), |
|||
{'salvar': 'salvar'}, |
|||
follow=True) |
|||
|
|||
assert (response.context_data['form'].errors['nome'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['sigla'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['endereco'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['cep'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['municipio'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['uf'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
|
|||
|
|||
@pytest.mark.django_db(transaction=False) |
|||
def test_incluir_tipo_autor_errors(admin_client): |
|||
|
|||
response = admin_client.post(reverse('sapl.base:tipoautor_create'), |
|||
{'salvar': 'salvar'}, |
|||
follow=True) |
|||
|
|||
assert (response.context_data['form'].errors['descricao'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
@ -1,11 +1,11 @@ |
|||
#!/bin/bash |
|||
|
|||
# (Re)cria todos os bancos postgres para migração |
|||
# cria um banco postgres (de mesmo nome) para cada banco mysql cujo nome começa com "sapl_" |
|||
|
|||
|
|||
if [ $# -eq 2 ]; then |
|||
parallel --verbose ./recria_um_db_postgres.sh :::: <(mysql -u $1 -p$2 -e 'show databases;' | grep '^sapl_' | grep -v '_copy$') |
|||
parallel --verbose -j+0 ./recria_um_db_postgres.sh :::: <(mysql -u $1 -p$2 -e 'show databases;' | grep '^sapl_' | grep -v '_copy$') |
|||
else |
|||
echo "USO:" |
|||
echo " ./recria_dbs_postgres.sh [usuário mysql] [senha mysql]" |
|||
fi; |
|||
|
|||
echo " $0 [usuário mysql] [senha mysql]" |
|||
fi; |
|||
@ -0,0 +1,49 @@ |
|||
import pytest |
|||
from django.core.urlresolvers import reverse |
|||
from django.utils.translation import ugettext_lazy as _ |
|||
from model_mommy import mommy |
|||
|
|||
from sapl.parlamentares.models import Legislatura, SessaoLegislativa |
|||
from sapl.sessao.models import SessaoPlenaria, TipoSessaoPlenaria |
|||
|
|||
|
|||
@pytest.mark.django_db(transaction=False) |
|||
def test_incluir_sessao_plenaria_submit(admin_client): |
|||
legislatura = mommy.make(Legislatura) |
|||
sessao = mommy.make(SessaoLegislativa) |
|||
tipo = mommy.make(TipoSessaoPlenaria) |
|||
|
|||
response = admin_client.post(reverse('sapl.sessao:sessaoplenaria_create'), |
|||
{'legislatura': str(legislatura.pk), |
|||
'numero': '1', |
|||
'tipo': str(tipo.pk), |
|||
'sessao_legislativa': str(sessao.pk), |
|||
'data_inicio': '10/11/2017', |
|||
'hora_inicio': '10:10' |
|||
}, follow=True) |
|||
|
|||
assert response.status_code == 200 |
|||
|
|||
sessao_plenaria = SessaoPlenaria.objects.first() |
|||
assert sessao_plenaria.tipo == tipo |
|||
|
|||
|
|||
@pytest.mark.django_db(transaction=False) |
|||
def test_incluir_sessao_errors(admin_client): |
|||
|
|||
response = admin_client.post(reverse('sapl.sessao:sessaoplenaria_create'), |
|||
{'salvar': 'salvar'}, |
|||
follow=True) |
|||
|
|||
assert (response.context_data['form'].errors['legislatura'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['sessao_legislativa'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['tipo'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['numero'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['data_inicio'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
assert (response.context_data['form'].errors['hora_inicio'] == |
|||
[_('Este campo é obrigatório.')]) |
|||
Loading…
Reference in new issue