Skip to content

Commit

Permalink
Ajustando resposta do exercício 02 da aula 04
Browse files Browse the repository at this point in the history
  • Loading branch information
dunossauro committed Oct 5, 2024
1 parent f446e39 commit e0ba080
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions aulas/exercicios_resolvidos/aula_04.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ A ideia é adicionar mais um campo na verificação do modelo, para que o update

```python hl_lines="7 8"
@contextmanager
def mock_db_time(*, model, time=datetime(2024, 1, 1)):
def _mock_db_time(*, model, time=datetime(2024, 1, 1)):

def fake_time_handler(mapper, connection, target):
if hasattr(target, 'created_at'):
Expand All @@ -59,7 +59,7 @@ def mock_db_time(*, model, time=datetime(2024, 1, 1)):
Com a alteração do modelo, o teste também passará a falhar. Isso pode ser modificado adicionando o campo `updated_at` no dicionário de validação:

```python hl_lines="17"
def test_create_user(session):
def test_create_user(session, mock_db_time):
with mock_db_time(model=User) as time:
new_user = User(
username='alice', password='secret', email='teste@test'
Expand Down

0 comments on commit e0ba080

Please sign in to comment.