Use UserClass instead of assigning dict to g.current_user
This commit is contained in:
@@ -43,11 +43,10 @@ def setup_db(admin_email):
|
|||||||
# Create a default project by faking a POST request.
|
# Create a default project by faking a POST request.
|
||||||
with current_app.test_request_context(data={'project_name': 'Default Project'}):
|
with current_app.test_request_context(data={'project_name': 'Default Project'}):
|
||||||
from flask import g
|
from flask import g
|
||||||
|
from pillar.auth import UserClass
|
||||||
from pillar.api.projects import routes as proj_routes
|
from pillar.api.projects import routes as proj_routes
|
||||||
|
|
||||||
g.current_user = {'user_id': user['_id'],
|
g.current_user = UserClass.construct('', user)
|
||||||
'groups': user['groups'],
|
|
||||||
'roles': set(user['roles'])}
|
|
||||||
|
|
||||||
proj_routes.create_project(overrides={'url': 'default-project',
|
proj_routes.create_project(overrides={'url': 'default-project',
|
||||||
'is_private': False})
|
'is_private': False})
|
||||||
|
Reference in New Issue
Block a user