当前位置: 首页>>代码示例>>Python>>正文


Python User.set_password方法代码示例

本文整理汇总了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()
开发者ID:TMoneyZ,项目名称:pybossa,代码行数:13,代码来源:cli.py

示例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
开发者ID:PyBossa,项目名称:pybossa,代码行数:17,代码来源:test_model_user.py

示例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
开发者ID:PyBossa,项目名称:pybossa,代码行数:30,代码来源:default.py

示例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
开发者ID:PyBossa,项目名称:pybossa,代码行数:24,代码来源:test_model_user.py


注:本文中的pybossa.model.user.User.set_password方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。