-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.py
36 lines (27 loc) · 1.38 KB
/
commands.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pytest
from app.models import Usuario, db
def test(coverage=False):
comandos = ['-s', './app/tests', '-p', 'no:warnings']
if coverage:
comandos.append('--cov')
pytest.main(comandos)
def seed():
usuarios = [
Usuario(nome='Leanne Graham', email='Sincere@april.biz', senha='Gwenborough'),
Usuario(nome='Ervin Howell', email='Shanna@melissa.tv', senha='Wisokyburgh'),
Usuario(nome='Clementine Bauch', email='Nathan@yesenia.net', senha='McKenziehaven'),
Usuario(nome='Patricia Lebsack', email='Julianne.OConner@kory.org', senha='South Elvis'),
Usuario(nome='Chelsey Dietrich', email='Lucio_Hettinger@annie.ca', senha='Roscoeview'),
Usuario(nome='Mrs. Dennis Schulist', email='Karley_Dach@jasper.info', senha='South Christy'),
Usuario(nome='Kurtis Weissnat', email='Telly.Hoeger@billy.biz', senha='Howemouth'),
Usuario(nome='Nicholas Runolfsdottir V', email='Sherwood@rosamond.me', senha='Aliyaview'),
Usuario(nome='Glenna Reichert', email='Chaim_McDermott@dana.io', senha='Bartholomebury'),
Usuario(nome='Clementina DuBuque', email='Rey.Padberg@karina.biz', senha='Lebsackbury')
]
for usuario in usuarios:
print('Incluindo usuario {}'.format(usuario.nome))
db.session.add(usuario)
db.session.commit()
print('Seed finnalizado.')
def drop_all():
db.drop_all()