add 'is_admin' flag to profile result
rendering of some pages (vendors, clouds, software, ...) needs to know which UI elements should be present on the page. instead of returning this flag in many requests I suggest to make it available in 'auth.current_user' structure on client side. This flag means that current user is in Foundation group. It will influence only to pages rendering. Change-Id: If8e993495bb301a4272532b6ecce6e1d4fdaa21e
This commit is contained in:
@@ -395,17 +395,21 @@ class ProfileControllerTestCase(BaseControllerTestCase):
|
||||
super(ProfileControllerTestCase, self).setUp()
|
||||
self.controller = user.ProfileController()
|
||||
|
||||
@mock.patch('refstack.db.get_foundation_users',
|
||||
return_value=['foo@bar.org'])
|
||||
@mock.patch('refstack.db.user_get',
|
||||
return_value=mock.Mock(openid='foo@bar.org',
|
||||
email='foo@bar.org',
|
||||
fullname='Dobby'))
|
||||
@mock.patch('refstack.api.utils.get_user_session',
|
||||
return_value={const.USER_OPENID: 'foo@bar.org'})
|
||||
def test_get(self, mock_get_user_session, mock_user_get):
|
||||
def test_get(self, mock_get_user_session, mock_user_get,
|
||||
mock_get_foundation_users):
|
||||
actual_result = self.controller.get()
|
||||
self.assertEqual({'openid': 'foo@bar.org',
|
||||
'email': 'foo@bar.org',
|
||||
'fullname': 'Dobby'}, actual_result)
|
||||
'fullname': 'Dobby',
|
||||
'is_admin': True}, actual_result)
|
||||
|
||||
|
||||
class AuthControllerTestCase(BaseControllerTestCase):
|
||||
|
||||
Reference in New Issue
Block a user