From b99f2e41394af83f4308280b2ca9edad13941032 Mon Sep 17 00:00:00 2001 From: Emanuele Bosu Date: Wed, 13 Nov 2024 11:26:15 +0100 Subject: [PATCH] Update user.py, test_user.py, and helpers.py --- backend/globaleaks/handlers/admin/user.py | 8 +++++++- backend/globaleaks/tests/handlers/admin/test_user.py | 3 ++- backend/globaleaks/tests/helpers.py | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/backend/globaleaks/handlers/admin/user.py b/backend/globaleaks/handlers/admin/user.py index b185bdc543..d8d94d7e44 100644 --- a/backend/globaleaks/handlers/admin/user.py +++ b/backend/globaleaks/handlers/admin/user.py @@ -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 diff --git a/backend/globaleaks/tests/handlers/admin/test_user.py b/backend/globaleaks/tests/handlers/admin/test_user.py index 091fb83be9..bdbdd42771 100644 --- a/backend/globaleaks/tests/handlers/admin/test_user.py +++ b/backend/globaleaks/tests/handlers/admin/test_user.py @@ -13,7 +13,8 @@ class TestAdminCollection(helpers.TestCollectionHandler): 'role': 'admin', 'name': 'Mario Rossi', 'mail_address': 'admin@theguardian.com', - 'language': 'en' + 'language': 'en', + 'wizard': True } } diff --git a/backend/globaleaks/tests/helpers.py b/backend/globaleaks/tests/helpers.py index 00aa74475e..f5fd00876b 100644 --- a/backend/globaleaks/tests/helpers.py +++ b/backend/globaleaks/tests/helpers.py @@ -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') @@ -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):