Skip to content

Commit 6759e31

Browse files
author
renzon
committed
Criado código base de teste de usuário
1 parent c991b9b commit 6759e31

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
def test_salvar_usuario():
2+
conexao = Conexao()
3+
sessao = conexao.gerar_sessao()
4+
usuario = Usuario(nome='Renzo')
5+
sessao.salvar(usuario)
6+
assert isinstance(usuario.id, int)
7+
sessao.roll_back()
8+
sessao.fechar()
9+
conexao.fechar()
10+
11+
12+
def test_listar_usuarios():
13+
conexao = Conexao()
14+
sessao = conexao.gerar_sessao()
15+
usuarios = [Usuario(nome='Renzo'), Usuario(nome='Luciano')]
16+
for usuario in usuarios:
17+
sessao.salvar(usuario)
18+
assert usuario == sessao.listar()
19+
sessao.roll_back()
20+
sessao.fechar()
21+
conexao.fechar()

0 commit comments

Comments
 (0)