Browse Source

Correct typo

producao
Marcio Mazza 10 years ago
parent
commit
7ad30508ad
  1. 1
      sigi/apps/casas/views.py
  2. 10
      sigi/apps/parlamentares/test_parlamentares.py
  3. 6
      sigi/test_cart.py

1
sigi/apps/casas/views.py

@ -2,7 +2,6 @@
import csv import csv
from functools import reduce from functools import reduce
from django.conf import settings
from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.core.paginator import Paginator, InvalidPage, EmptyPage
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render from django.shortcuts import render

10
sigi/apps/parlamentares/test_parlamentares.py

@ -9,27 +9,27 @@ pytestmark = pytest.mark.django_db
@pytest.fixture @pytest.fixture
def some_parlamentarians(): def some_parliamentarians():
a = G(Parlamentar, nome_completo="Andre Silva", foto=None) a = G(Parlamentar, nome_completo="Andre Silva", foto=None)
b = G(Parlamentar, nome_completo="Bartolomeu Gusmao", foto=None) b = G(Parlamentar, nome_completo="Bartolomeu Gusmao", foto=None)
c = G(Parlamentar, nome_completo="Camila Carla", foto=None) c = G(Parlamentar, nome_completo="Camila Carla", foto=None)
return a, b, c return a, b, c
def test_list_all(some_parlamentarians, app): def test_list_all(some_parliamentarians, app):
response = app.get('/parlamentares/parlamentar/') response = app.get('/parlamentares/parlamentar/')
assert response.status_code == 200 assert response.status_code == 200
for x in some_parlamentarians: for x in some_parliamentarians:
assert x.nome_completo in response.content assert x.nome_completo in response.content
def test_list_filtered_by_capital_letter(some_parlamentarians, app): def test_list_filtered_by_capital_letter(some_parliamentarians, app):
response = app.get('/parlamentares/parlamentar/?nome_completo=B') response = app.get('/parlamentares/parlamentar/?nome_completo=B')
assert response.status_code == 200 assert response.status_code == 200
decoded_content = response.content.decode('utf-8') decoded_content = response.content.decode('utf-8')
a, b, c = some_parlamentarians a, b, c = some_parliamentarians
assert a.nome_completo not in decoded_content assert a.nome_completo not in decoded_content
assert b.nome_completo in decoded_content assert b.nome_completo in decoded_content
assert c.nome_completo not in decoded_content assert c.nome_completo not in decoded_content

6
sigi/test_cart.py

@ -1,15 +1,15 @@
import pytest import pytest
from sigi.apps.casas.test_casas import some_parliaments from sigi.apps.casas.test_casas import some_parliaments
from sigi.apps.parlamentares.test_parlamentares import some_parlamentarians from sigi.apps.parlamentares.test_parlamentares import some_parliamentarians
from sigi.testutils import pdf_text from sigi.testutils import pdf_text
@pytest.mark.parametrize("url, some_entries, form_action, name_attr, verbose_name_plural", [ @pytest.mark.parametrize("url, some_entries, form_action, name_attr, verbose_name_plural", [
('/parlamentares/parlamentar/', some_parlamentarians, 'adiciona_parlamentar', 'nome_completo', 'Parlamentares'), ('/parlamentares/parlamentar/', some_parliamentarians, 'adiciona_parlamentar', 'nome_completo', 'Parlamentares'),
('/casas/casalegislativa/', some_parliaments, 'adicionar_casas', 'nome', 'Casas Legislativas'), ('/casas/casalegislativa/', some_parliaments, 'adicionar_casas', 'nome', 'Casas Legislativas'),
]) ])
def test_add_to_cart(url, some_entries, form_action, name_attr, verbose_name_plural, app, live_server): def test_add_to_cart(url, some_entries, form_action, name_attr, verbose_name_plural, app):
a, b, c = some_entries() a, b, c = some_entries()

Loading…
Cancel
Save