本文整理匯總了Python中askomics.libaskomics.ParamManager.ParamManager.get_user_dir_path方法的典型用法代碼示例。如果您正苦於以下問題:Python ParamManager.get_user_dir_path方法的具體用法?Python ParamManager.get_user_dir_path怎麽用?Python ParamManager.get_user_dir_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類askomics.libaskomics.ParamManager.ParamManager
的用法示例。
在下文中一共展示了ParamManager.get_user_dir_path方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_users_infos
# 需要導入模塊: from askomics.libaskomics.ParamManager import ParamManager [as 別名]
# 或者: from askomics.libaskomics.ParamManager.ParamManager import get_user_dir_path [as 別名]
def test_get_users_infos(self):
"""Test get_users_infos"""
self.tps.clean_up()
# first test with non admin
try :
data = self.askview.get_users_infos()
assert False
except Exception as e:
assert True
# then, is user is admin
self.request.session['admin'] = True
data = self.askview.get_users_infos()
assert data == {'result': [], 'me': 'jdoe'} #result is empty cause there is no user
#test with user
self.request.json_body = {
'username': 'jdoe',
'email': '[email protected]',
'password': 'iamjohndoe',
'password2': 'iamjohndoe'
}
# get dir size
pm = ParamManager(self.settings, self.request.session)
dir_size = pm.get_size(pm.get_user_dir_path())
human_dir_size = humanize.naturalsize(dir_size)
self.askview.signup()
data = self.askview.get_users_infos()
assert data == {'result': [{'ldap': False, 'username': 'jdoe', 'email': '[email protected]', 'admin': True, 'blocked': False, 'gurl': None, 'nquery': 0, 'nintegration': 0, 'dirsize': dir_size, 'hdirsize': human_dir_size}], 'me': 'jdoe', 'error': [], 'user_id': 1, 'username': 'jdoe', 'email': '[email protected]', 'admin': True, 'blocked': False, 'galaxy': None}