Skip to content

Commit

Permalink
Update user.py, test_user.py, and helpers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Emanuele Bosu committed Nov 13, 2024
1 parent 34b693b commit b99f2e4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion backend/globaleaks/handlers/admin/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,13 @@ def post(self):
logging.debug(e)
request['fiscal_code'] = None

user = yield create_user(self.request.tid, self.session, request, self.request.language)
try:
wizard = json.loads(body).get('wizard')
except Exception as e:
logging.debug(e)
wizard = False

user = yield create_user(self.request.tid, self.session, request, self.request.language, wizard)

return user

Expand Down
3 changes: 2 additions & 1 deletion backend/globaleaks/tests/handlers/admin/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class TestAdminCollection(helpers.TestCollectionHandler):
'role': 'admin',
'name': 'Mario Rossi',
'mail_address': '[email protected]',
'language': 'en'
'language': 'en',
'wizard': True
}
}

Expand Down
5 changes: 3 additions & 2 deletions backend/globaleaks/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ def test_get(self):

data = self.get_dummy_request()

yield self._test_desc['create'](1, self.session, data, 'en')
yield self._test_desc['create'](1, self.session, data, 'en', wizard=True)

handler = self.request(role='admin')

Expand All @@ -1065,7 +1065,8 @@ def test_post(self):
data = yield handler.post()

for k, v in self._test_desc['data'].items():
self.assertEqual(data[k], v)
if k != 'wizard':
self.assertEqual(data[k], v)


class TestInstanceHandler(TestHandler):
Expand Down

0 comments on commit b99f2e4

Please sign in to comment.