• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python login.create函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中weasyl.login.create函数的典型用法代码示例。如果您正苦于以下问题:Python create函数的具体用法?Python create怎么用?Python create使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_create_fails_if_email_is_invalid

def test_create_fails_if_email_is_invalid():
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=';--', emailcheck=';--',
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'emailInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:7,代码来源:test_create.py


示例2: test_create_fails_if_email_and_emailcheck_dont_match

def test_create_fails_if_email_and_emailcheck_dont_match():
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'emailMismatch' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:7,代码来源:test_create.py


示例3: test_usernames_must_be_unique

def test_usernames_must_be_unique():
    db_utils.create_user(username=user_name, email_addr="[email protected]")
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'usernameExists' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:8,代码来源:test_create.py


示例4: test_passwords_must_match

def test_passwords_must_match():
    # Check for failure if password != passcheck
    form = Bag(username=user_name, password='123', passcheck='qwe',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'passwordMismatch' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:8,代码来源:test_create.py


示例5: test_under_13_age_raises_birthdayInvalid_WeasylError

def test_under_13_age_raises_birthdayInvalid_WeasylError():
    # Check for failure state if computed birthday is <13 years old
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='12', year=arrow.now().year - 11)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:8,代码来源:test_create.py


示例6: test_username_cannot_match_an_active_alias

def test_username_cannot_match_an_active_alias():
    user_id = db_utils.create_user(username='aliastest')
    d.engine.execute("INSERT INTO useralias VALUES (%(userid)s, %(username)s, 'p')", userid=user_id, username=user_name)
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'usernameExists' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:9,代码来源:test_create.py


示例7: test_verify_correct_information_creates_account

def test_verify_correct_information_creates_account():
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    login.create(form)
    # This record should exist when this function completes successfully
    assert d.engine.scalar(
        "SELECT EXISTS (SELECT 0 FROM logincreate WHERE login_name = %(name)s)",
        name=form.username)
开发者ID:makyo,项目名称:weasyl,代码行数:9,代码来源:test_create.py


示例8: test_create_fails_if_username_is_a_prohibited_name

def test_create_fails_if_username_is_a_prohibited_name():
    form = Bag(username='testloginsuite', password='0123456789', passcheck='0123456789',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='12', year=arrow.now().year - 19)
    prohibited_names = ["admin", "administrator", "mod", "moderator", "weasyl",
                        "weasyladmin", "weasylmod", "staff", "security"]
    for name in prohibited_names:
        form.username = name
        with pytest.raises(WeasylError) as err:
            login.create(form)
        assert 'usernameInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:11,代码来源:test_create.py


示例9: test_username_cant_be_blank_or_have_semicolon

def test_username_cant_be_blank_or_have_semicolon():
    form = Bag(username='...', password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'usernameInvalid' == err.value.value
    form.username = 'testloginsuite;'
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'usernameInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:11,代码来源:test_create.py


示例10: test_create_fails_if_another_account_has_email_linked_to_their_account

def test_create_fails_if_another_account_has_email_linked_to_their_account():
    """
    Test checks to see if an email is tied to an active user account. If so,
    login.create() will not permit another account to be made for the same
    address.
    """
    db_utils.create_user(username=user_name, email_addr=email_addr)
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'emailExists' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:13,代码来源:test_create.py


示例11: test_create_fails_if_another_account_has_email_linked_to_their_account

def test_create_fails_if_another_account_has_email_linked_to_their_account():
    """
    Test checks to see if an email is tied to an active user account. If so,
    login.create() will not permit another account to be made for the same
    address.
    """
    db_utils.create_user(username=user_name, email_addr=email_addr)
    form = Bag(username="user", password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    login.create(form)
    query = d.engine.scalar("""
        SELECT username FROM logincreate WHERE username = %(username)s AND invalid IS TRUE
    """, username=form.username)
    assert query == "user"
开发者ID:Syfaro,项目名称:weasyl,代码行数:15,代码来源:test_create.py


示例12: test_passwords_must_be_of_sufficient_length

def test_passwords_must_be_of_sufficient_length():
    password = "tooShort"
    form = Bag(username=user_name, password=password, passcheck=password,
               email='foo', emailcheck='foo',
               day='12', month='12', year=arrow.now().year - 19)
    # Insecure length
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'passwordInsecure' == err.value.value
    # Secure length
    password = "thisIsAcceptable"
    form.passcheck = form.password = password
    # emailInvalid is the next failure state after passwordInsecure, so it is a 'success' for this testcase
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'emailInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:16,代码来源:test_create.py


示例13: test_usernames_cannot_match_pending_account_usernames

def test_usernames_cannot_match_pending_account_usernames():
    d.engine.execute(d.meta.tables["logincreate"].insert(), {
        "token": 40 * "a",
        "username": user_name,
        "login_name": user_name,
        "hashpass": login.passhash(raw_password),
        "email": "[email protected]",
        "birthday": arrow.Arrow(2000, 1, 1),
        "unixtime": arrow.now(),
    })
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'usernameExists' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:16,代码来源:test_create.py


示例14: test_create_fails_if_email_domain_is_blacklisted

def test_create_fails_if_email_domain_is_blacklisted():
    """
    Test verifies that login.create() will properly fail to register new accounts
    when the domain portion of the email address is contained in the emailblacklist
    table.
    """
    d.engine.execute(d.meta.tables["emailblacklist"].insert(), {
        "domain_name": "blacklisted.com",
        "reason": "test case for login.create()",
        "added_by": db_utils.create_user(),
    })
    blacklisted_email = "[email protected]"
    form = Bag(username=user_name, password='0123456789', passcheck='0123456789',
               email=blacklisted_email, emailcheck=blacklisted_email,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'emailBlacklisted' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:18,代码来源:test_create.py


示例15: signup_post_

def signup_post_(request):
    form = request.web_input(
        username="", password="", passcheck="", email="", emailcheck="",
        day="", month="", year="")

    if 'g-recaptcha-response' not in form or not define.captcha_verify(form['g-recaptcha-response']):
        return Response(define.errorpage(
            request.userid,
            "There was an error validating the CAPTCHA response; you should go back and try again."))

    login.create(form)
    return Response(define.errorpage(
        request.userid,
        "**Success!** Your username has been reserved and a message "
        "has been sent to the email address you provided with "
        "information on how to complete the registration process. You "
        "should receive this email within the next hour.",
        [["Return to the Home Page", "/"]]))
开发者ID:Weasyl,项目名称:weasyl,代码行数:18,代码来源:user.py


示例16: POST

    def POST(self):
        form = web.input(
            username="", password="", passcheck="", email="", emailcheck="",
            day="", month="", year="", recaptcha_challenge_field="", recaptcha_response_field="")

        if not define.captcha_verify(form):
            return define.errorpage(
                self.user_id,
                "The image verification you entered was not correct; you should go back and try again.")

        login.create(form)
        return define.errorpage(
            self.user_id,
            "**Success!** Your username has been reserved and a "
            "message has been sent to the email address you specified with "
            "information on how to complete the registration process. You "
            "should receive this email within the next hour.",
            [["Return to the Home Page", "/index"]])
开发者ID:0x15,项目名称:weasyl,代码行数:18,代码来源:user.py


示例17: test_create_fails_if_pending_account_has_same_email

def test_create_fails_if_pending_account_has_same_email():
    """
    Test checks to see if an email is tied to a pending account creation entry
    in logincreate. If so, login.create() will not permit another account to be
    made for the same address.
    """
    d.engine.execute(d.meta.tables["logincreate"].insert(), {
        "token": 40 * "a",
        "username": "existing",
        "login_name": "existing",
        "hashpass": login.passhash(raw_password),
        "email": email_addr,
        "birthday": arrow.Arrow(2000, 1, 1),
        "unixtime": arrow.now(),
    })
    form = Bag(username="test", password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'emailExists' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:21,代码来源:test_create.py


示例18: test_create_fails_if_pending_account_has_same_email

def test_create_fails_if_pending_account_has_same_email():
    """
    Test checks to see if an email is tied to a pending account creation entry
    in logincreate. If so, login.create() will not permit another account to be
    made for the same address.
    """
    d.engine.execute(d.meta.tables["logincreate"].insert(), {
        "token": 40 * "a",
        "username": "existing",
        "login_name": "existing",
        "hashpass": login.passhash(raw_password),
        "email": email_addr,
        "birthday": arrow.Arrow(2000, 1, 1),
        "unixtime": arrow.now(),
    })
    form = Bag(username="test", password='0123456789', passcheck='0123456789',
               email=email_addr, emailcheck=email_addr,
               day='12', month='12', year=arrow.now().year - 19)
    login.create(form)
    query = d.engine.scalar("""
        SELECT username FROM logincreate WHERE username = %(username)s AND invalid IS TRUE
    """, username=form.username)
    assert query == "test"
开发者ID:Syfaro,项目名称:weasyl,代码行数:23,代码来源:test_create.py


示例19: test_DMY_missing_raises_birthdayInvalid_WeasylError

def test_DMY_missing_raises_birthdayInvalid_WeasylError():
    # Check for failure state if 'year' is not an valid year e.g., -1
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day=None, month='12', year='2000')
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value

    # Check for failure state if 'year' is not an valid year e.g., -1
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month=None, year='2000')
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value

    # Check for failure state if 'year' is not an valid year e.g., -1
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='12', year=None)
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:24,代码来源:test_create.py


示例20: test_DMY_out_of_valid_ranges_raises_birthdayInvalid_WeasylError

def test_DMY_out_of_valid_ranges_raises_birthdayInvalid_WeasylError():
    # Check for failure state if 'day' is not an valid day e.g., 42
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day='42', month='12', year='2000')
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value

    # Check for failure state if 'month' is not an valid month e.g., 42
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='42', year='2000')
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value

    # Check for failure state if 'year' is not an valid year e.g., -1
    form = Bag(username=user_name, password='', passcheck='',
               email='[email protected]', emailcheck='[email protected]',
               day='12', month='12', year='-1')
    with pytest.raises(WeasylError) as err:
        login.create(form)
    assert 'birthdayInvalid' == err.value.value
开发者ID:makyo,项目名称:weasyl,代码行数:24,代码来源:test_create.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python profile.resolve函数代码示例发布时间:2022-05-26
下一篇:
Python define.webpage函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap