本文整理汇总了Python中askomics.libaskomics.ParamManager.ParamManager.get_size方法的典型用法代码示例。如果您正苦于以下问题:Python ParamManager.get_size方法的具体用法?Python ParamManager.get_size怎么用?Python ParamManager.get_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类askomics.libaskomics.ParamManager.ParamManager
的用法示例。
在下文中一共展示了ParamManager.get_size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_users_infos
# 需要导入模块: from askomics.libaskomics.ParamManager import ParamManager [as 别名]
# 或者: from askomics.libaskomics.ParamManager.ParamManager import get_size [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}