mirror of https://github.com/interlegis/sapl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
876 B
25 lines
876 B
9 years ago
|
import pytest
|
||
|
from django.core.urlresolvers import reverse
|
||
|
from model_mommy import mommy
|
||
|
|
||
|
from .models import Legislatura, Parlamentar
|
||
|
|
||
|
|
||
|
@pytest.mark.django_db(transaction=False)
|
||
|
def test_cadastro_parlamentar(client):
|
||
|
mommy.make(Legislatura, pk=5)
|
||
|
|
||
|
response = client.get(reverse('parlamentares_cadastro', kwargs={'pk': 5}))
|
||
|
assert response.status_code == 200
|
||
|
|
||
|
response = client.post(reverse('parlamentares_cadastro', kwargs={'pk': 5}),
|
||
|
{'nome_completo': 'Teresa Barbosa',
|
||
|
'nome_parlamentar': 'Terezinha',
|
||
|
'sexo': 'F',
|
||
|
'ativo': 'True',
|
||
|
})
|
||
|
parlamentar = Parlamentar.objects.first()
|
||
|
assert "Chacrinha" == parlamentar.nome_parlamentar
|
||
|
if not parlamentar.ativo:
|
||
|
pytest.fail("Parlamentar deve estar ativo")
|