-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adicionado a busca dinamica do modulo e aulas
Close #30
- Loading branch information
1 parent
419727d
commit ad0e4e9
Showing
4 changed files
with
55 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,47 @@ | ||
from django.urls import reverse | ||
import pytest | ||
# from project.django_assertions import assert_contains | ||
from model_bakery import baker | ||
from project.modulos.models import Modulo, Aula | ||
from project.django_assertions import assert_contains | ||
|
||
|
||
@pytest.fixture | ||
def resp(client, db): | ||
resp = client.get(reverse('modulos:detalhe', kwargs={'slug': 'introducao'})) | ||
def modulo(db): | ||
return baker.make(Modulo) | ||
|
||
|
||
@pytest.fixture | ||
def aulas(modulo): | ||
return baker.make(Aula, 3, modulo=modulo) | ||
|
||
|
||
@pytest.fixture | ||
def resp(client, modulo, aulas): | ||
resp = client.get(reverse('modulos:detalhe', kwargs={'slug': modulo.slug})) | ||
return resp | ||
|
||
|
||
def test_status_code(resp): | ||
assert resp.status_code == 200 | ||
|
||
|
||
def test_titulo(resp, modulo): | ||
assert_contains(resp, f'<h3>{modulo.titulo}</h3>') | ||
|
||
|
||
def test_publico(resp, modulo): | ||
assert_contains(resp, modulo.publico) | ||
|
||
|
||
def test_descricao(resp, modulo): | ||
assert_contains(resp, modulo.descricao) | ||
|
||
|
||
def test_aulas_titulo(resp, aulas): | ||
for aula in aulas: | ||
assert_contains(resp, aula.titulo) | ||
|
||
|
||
def test_aulas_link(resp, aulas): | ||
for aula in aulas: | ||
assert_contains(resp, aula.get_absolute_url()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters