本文整理汇总了Python中pybossa.model.user.User.set_password方法的典型用法代码示例。如果您正苦于以下问题:Python User.set_password方法的具体用法?Python User.set_password怎么用?Python User.set_password使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybossa.model.user.User
的用法示例。
在下文中一共展示了User.set_password方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fixtures
# 需要导入模块: from pybossa.model.user import User [as 别名]
# 或者: from pybossa.model.user.User import set_password [as 别名]
def fixtures():
'''Create some fixtures!'''
with app.app_context():
user = User(
name=u'tester',
email_addr=u'[email protected]',
api_key='tester'
)
user.set_password(u'tester')
db.session.add(user)
db.session.commit()
示例2: test_user_public_info_keys
# 需要导入模块: from pybossa.model.user import User [as 别名]
# 或者: from pybossa.model.user.User import set_password [as 别名]
def test_user_public_info_keys(self):
"""Test public info keys works."""
user = User(
email_addr="[email protected]",
name="johndoe",
fullname="John Doe",
info=dict(avatar='image.png', container='foldr3', token='security'),
locale="en")
public_info_keys = ['avatar', 'container']
user.set_password("juandiso")
assert public_info_keys.sort() == user.public_info_keys().sort()
data = user.to_public_json()
err_msg = "There are some keys that should not be public"
assert data.get('info').keys().sort() == public_info_keys.sort(), err_msg
示例3: create_users
# 需要导入模块: from pybossa.model.user import User [as 别名]
# 或者: from pybossa.model.user.User import set_password [as 别名]
def create_users(cls):
root = User(
email_addr = cls.root_addr,
name = cls.root_name,
passwd_hash = cls.root_password,
fullname = cls.fullname,
api_key = cls.root_api_key)
root.set_password(cls.root_password)
user = User(
email_addr = cls.email_addr,
name = cls.name,
passwd_hash = cls.password,
fullname = cls.fullname,
api_key = cls.api_key)
user.set_password(cls.password)
user2 = User(
email_addr = cls.email_addr2,
name = cls.name2,
passwd_hash = cls.password + "2",
fullname = cls.fullname2,
api_key=cls.api_key_2)
user2.set_password(cls.password)
return root, user, user2
示例4: test_user_public_attributes
# 需要导入模块: from pybossa.model.user import User [as 别名]
# 或者: from pybossa.model.user.User import set_password [as 别名]
def test_user_public_attributes(self):
"""Test public attributes works."""
user = User(
email_addr="[email protected]",
name="johndoe",
pro=1,
fullname="John Doe",
locale="en")
public_attributes = ['created', 'name', 'fullname', 'locale', 'info',
'task_runs', 'registered_ago', 'rank', 'score']
user.set_password("juandiso")
assert public_attributes.sort() == user.public_attributes().sort()
data = user.to_public_json()
err_msg = "There are some keys that should not be public"
assert data.keys().sort() == public_attributes.sort(), err_msg
all_attributes = user.dictize().keys()
s = set(public_attributes)
private_attributes = [x for x in all_attributes if x not in s]
for attr in private_attributes:
err_msg = "This attribute should be private %s" % attr
assert data.get(attr) is None, err_msg