|
|
@ -20,21 +20,14 @@ def test_cadastro_parlamentar(admin_client): |
|
|
response = admin_client.post(url, {'nome_completo': 'Teresa Barbosa', |
|
|
response = admin_client.post(url, {'nome_completo': 'Teresa Barbosa', |
|
|
'nome_parlamentar': 'Terezinha', |
|
|
'nome_parlamentar': 'Terezinha', |
|
|
'sexo': 'F', |
|
|
'sexo': 'F', |
|
|
'ativo': 'True', |
|
|
'ativo': 'True' |
|
|
'legislatura': legislatura.id, |
|
|
}, |
|
|
'data_expedicao_diploma': '2001-01-01'}, |
|
|
|
|
|
follow=True) |
|
|
follow=True) |
|
|
|
|
|
|
|
|
[parlamentar] = Parlamentar.objects.all() |
|
|
[parlamentar] = Parlamentar.objects.all() |
|
|
assert parlamentar.nome_parlamentar == 'Terezinha' |
|
|
assert parlamentar.nome_parlamentar == 'Terezinha' |
|
|
assert parlamentar.sexo == 'F' |
|
|
assert parlamentar.sexo == 'F' |
|
|
assert parlamentar.ativo is True |
|
|
assert parlamentar.ativo is True |
|
|
# o primeiro mandato é criado |
|
|
|
|
|
[mandato] = Mandato.objects.all() |
|
|
|
|
|
assert mandato.parlamentar == parlamentar |
|
|
|
|
|
assert str(mandato.data_expedicao_diploma) == '2001-01-01' |
|
|
|
|
|
assert mandato.legislatura == legislatura |
|
|
|
|
|
assert mandato.data_fim_mandato == legislatura.data_fim |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.django_db(transaction=False) |
|
|
@pytest.mark.django_db(transaction=False) |
|
|
@ -42,9 +35,7 @@ def test_incluir_parlamentar_errors(admin_client): |
|
|
url = reverse('sapl.parlamentares:parlamentar_create') |
|
|
url = reverse('sapl.parlamentares:parlamentar_create') |
|
|
response = admin_client.post(url) |
|
|
response = admin_client.post(url) |
|
|
erros_esperados = {campo: ['Este campo é obrigatório.'] |
|
|
erros_esperados = {campo: ['Este campo é obrigatório.'] |
|
|
for campo in ['legislatura', |
|
|
for campo in ['nome_parlamentar', |
|
|
'data_expedicao_diploma', |
|
|
|
|
|
'nome_parlamentar', |
|
|
|
|
|
'nome_completo', |
|
|
'nome_completo', |
|
|
'sexo', |
|
|
'sexo', |
|
|
]} |
|
|
]} |
|
|
|