let only admin
This commit is contained in:
25
initdb.py
25
initdb.py
@@ -18,41 +18,22 @@ def clean_db():
|
|||||||
def init_test_db(db):
|
def init_test_db(db):
|
||||||
# clean up everything before starting
|
# clean up everything before starting
|
||||||
# models.Attendee.__table__.drop(engine)
|
# models.Attendee.__table__.drop(engine)
|
||||||
# models.Event.__table__.drop(engine)
|
|
||||||
# models.Team.__table__.drop(engine)
|
|
||||||
# models.Contract.__table__.drop(engine)
|
|
||||||
# models.Customer.__table__.drop(engine)
|
|
||||||
# models.Collaborator.__table__.drop(engine)
|
|
||||||
# models.Credentials.__table__.drop(engine)
|
|
||||||
|
|
||||||
# create teams
|
|
||||||
teams = ["commercial", "management", "support"]
|
teams = ["commercial", "management", "support"]
|
||||||
for item in teams:
|
for item in teams:
|
||||||
team = models.Team(name=item)
|
team = models.Team(name=item)
|
||||||
write_db(db, team)
|
write_db(db, team)
|
||||||
|
|
||||||
# create a commercial
|
|
||||||
com1 = models.Collaborator(name="com1",
|
|
||||||
email="com1@truc.fr",
|
|
||||||
phone=1092837465,
|
|
||||||
team_id=1,
|
|
||||||
)
|
|
||||||
write_db(db, com1)
|
|
||||||
commercial_password = models.Credentials(
|
|
||||||
collaborator_id=com1.id,
|
|
||||||
password_hash=argon2.hash("testtest"))
|
|
||||||
write_db(db, commercial_password)
|
|
||||||
|
|
||||||
# create a manager
|
# create a manager
|
||||||
man = models.Collaborator(name="admin",
|
man = models.Collaborator(name="admin",
|
||||||
email="pp",
|
email="a",
|
||||||
phone=2,
|
phone=1,
|
||||||
team_id=2,
|
team_id=2,
|
||||||
)
|
)
|
||||||
write_db(db, man)
|
write_db(db, man)
|
||||||
man_password = models.Credentials(
|
man_password = models.Credentials(
|
||||||
collaborator_id = man.id,
|
collaborator_id = man.id,
|
||||||
password_hash = argon2.hash("testtest"))
|
password_hash = argon2.hash("password"))
|
||||||
write_db(db, man_password)
|
write_db(db, man_password)
|
||||||
|
|
||||||
# create an attendee
|
# create an attendee
|
||||||
|
|||||||
Reference in New Issue
Block a user