forked from ScoDoc/DocScoDoc
ajout creation user "bach" pour certains tests
This commit is contained in:
parent
383fdb0e53
commit
06f66e6976
@ -30,11 +30,18 @@ def test_client():
|
|||||||
db.create_all()
|
db.create_all()
|
||||||
Role.insert_roles()
|
Role.insert_roles()
|
||||||
u = User(user_name="admin")
|
u = User(user_name="admin")
|
||||||
admin_role = Role.query.filter_by(name="SuperAdmin").first()
|
super_admin_role = Role.query.filter_by(name="SuperAdmin").first()
|
||||||
u.add_role(admin_role, "TEST00")
|
u.add_role(super_admin_role, "TEST00")
|
||||||
# u.set_password("admin")
|
# u.set_password("admin")
|
||||||
login_user(u)
|
login_user(u)
|
||||||
# db.session.add(u)
|
# Vérifie que l'utilisateur bach existe
|
||||||
|
u = User.query.filter_by(user_name="bach").first()
|
||||||
|
if u is None:
|
||||||
|
u = User(user_name="bach")
|
||||||
|
if not "Admin" in {r.name for r in u.roles}:
|
||||||
|
admin_role = Role.query.filter_by(name="Admin").first()
|
||||||
|
u.add_role(admin_role, "TEST00")
|
||||||
|
db.session.add(u)
|
||||||
ndb.set_sco_dept("TEST00") # set db connection
|
ndb.set_sco_dept("TEST00") # set db connection
|
||||||
truncate_database() # erase tables
|
truncate_database() # erase tables
|
||||||
yield client
|
yield client
|
||||||
|
Loading…
Reference in New Issue
Block a user