Skip to content

Commit f6184f6

Browse files
author
Pbezerra-dev
committed
fix tests and links for modulos
1 parent a20ab8b commit f6184f6

File tree

8 files changed

+17
-6
lines changed

8 files changed

+17
-6
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ repos:
55
- id: black
66
name: Black
77
args: ["-S", "--line-length", "120"]
8-
language_version: python3.7
8+
language_version: python3.8
99

1010
- repo: https://github.com/asottile/reorder_python_imports
1111
rev: v2.3.0

pypro/core/templates/core/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</a>
4242
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
4343
{% for modulo in MODULOS %}
44-
<a class="dropdown-item" href="#">{{ modulo.titulo }}</a>
44+
<a class="dropdown-item" href="{{ modulo.get_absolute_url }}">{{ modulo.titulo }}</a>
4545
<div class="dropdown-divider"></div>
4646
{% endfor %}
4747
</div>

pypro/core/tests/test_home.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
@pytest.fixture
8-
def response(client):
8+
def response(client, db):
99
resp = client.get(reverse('core:home'))
1010
return resp
1111

pypro/modulos/tests/test_aba_de_modulos.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ def response(client, modulos):
1919

2020
def test_titulos_dos_modulos(response, modulos):
2121
for modulo in modulos:
22-
assert_contains(response, modulo.titulo)
22+
assert_contains(response, modulo.get_absolute_url())

pypro/modulos/tests/test_facade.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def modulos(db):
1111

1212

1313
def test_listar_modulos_ordenados(modulos):
14-
assert list(sorted(modulos, key=lambda modulo: modulo.titulo)) == facade.listar_modulos_ordenados()
14+
assert list(sorted(modulos, key=lambda modulo: modulo.order)) == facade.listar_modulos_ordenados()

pypro/modulos/urls.py

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from django.urls import path
2+
3+
from pypro.modulos import views
4+
5+
app_name = 'modulos'
6+
7+
urlpatterns = [path('<slug:slug>', views.detalhes, name='detalhe')]

pypro/modulos/views.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def detalhes(request, slug):
2+
pass

pypro/urls.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
"""
1616
from django.conf import settings
1717
from django.contrib import admin
18-
from django.urls import include, path
18+
from django.urls import include
19+
from django.urls import path
1920

2021
urlpatterns = [
2122
path('admin/', admin.site.urls),
2223
path('', include('pypro.core.urls')),
2324
path('aperitivos/', include('pypro.aperitivos.urls')),
25+
path('modulos/', include('pypro.modulos.urls')),
2426
]
2527

2628
if settings.DEBUG:

0 commit comments

Comments
 (0)