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


Python User.create_user方法代码示例

本文整理汇总了Python中bespin.database.User.create_user方法的典型用法代码示例。如果您正苦于以下问题:Python User.create_user方法的具体用法?Python User.create_user怎么用?Python User.create_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bespin.database.User的用法示例。


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

示例1: test_bad_login_yields_401

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def test_bad_login_yields_401():
    s = _get_session(True)
    User.create_user("BillBixby", "hulkrulez", "[email protected]")
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/login/BillBixby",
        dict(password="NOTHULK"), status=401)
开发者ID:Jangts,项目名称:bespin,代码行数:9,代码来源:test_users.py

示例2: _init_data

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def _init_data():
    global macgyver, someone_else, murdoc
    config.activate_profile()
    
    fsroot = config.c.fsroot
    if fsroot.exists() and fsroot.basename() == "testfiles":
        fsroot.rmtree()
    fsroot.makedirs()
    
    app.reset()
    
    Base.metadata.drop_all(bind=config.c.dbengine)
    Base.metadata.create_all(bind=config.c.dbengine)
    s = config.c.session_factory()
    
    someone_else = User.create_user("SomeoneElse", "", "[email protected]")
    murdoc = User.create_user("Murdoc", "", "[email protected]")
    
    otherproject = get_project(someone_else, someone_else,
                                            "otherproject", create=True)
    otherproject.save_file('foo', 'Just a file to reserve a project')
    
    app.post("/register/new/MacGyver", 
        dict(password="richarddean", email="[email protected]"))
        
    macgyver = User.find_user("MacGyver")
开发者ID:mozilla,项目名称:bespinserver,代码行数:28,代码来源:test_files.py

示例3: _reset

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def _reset():
    Base.metadata.drop_all(bind=config.c.dbengine)
    Base.metadata.create_all(bind=config.c.dbengine)
    fsroot = config.c.fsroot
    if fsroot.exists() and fsroot.basename() == "testfiles":
        fsroot.rmtree()
    fsroot.makedirs()

    global session
    session = config.c.session_factory()
    num_users = session.query(User).count()
    assert_equals(num_users, 0)
    session.commit()

    global mattb, zuck, tom, ev, joe
    mattb = User.create_user("mattb", "mattb", "mattb")
    zuck = User.create_user("zuck", "zuck", "zuck")
    tom = User.create_user("tom", "tom", "tom")
    ev = User.create_user("ev", "ev", "ev")
    joe = User.create_user("joe", "joe", "joe")
    group = joe.add_group("group")
    group.add_member(mattb)
    group.add_member(zuck)
    group.add_member(tom)
    group.add_member(ev)

    global app
    app = controllers.make_app()
    app = BespinTestApp(app)
    app.post("/register/login/joe", dict(password="joe"))
开发者ID:mozilla,项目名称:bespinserver,代码行数:32,代码来源:test_collab.py

示例4: test_login_without_cookie

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def test_login_without_cookie():
    s = _get_session(True)
    User.create_user("BillBixby", "hulkrulez", "[email protected]")
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/login/BillBixby",
        dict(password="hulkrulez"))
    assert resp.cookies_set['auth_tkt']
开发者ID:Jangts,项目名称:bespin,代码行数:10,代码来源:test_users.py

示例5: setup_module

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def setup_module(module):
    global app, session
    config.set_profile('test')
    config.activate_profile()
    Base.metadata.drop_all(bind=config.c.dbengine)
    Base.metadata.create_all(bind=config.c.dbengine)
    session = config.c.session_factory()
    User.create_user("BillBixby", "", "[email protected]")
    app = controllers.make_app()
    app = BespinTestApp(app)
    app.post("/register/login/BillBixby", dict(password=""))
开发者ID:mozilla,项目名称:bespinserver,代码行数:13,代码来源:test_settings.py

示例6: test_create_duplicate_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def test_create_duplicate_user():
    s = _get_session(True)
    u = User.create_user("BillBixby", "somepass", "[email protected]")
    s.commit()
    original_password = u.password
    try:
        User.create_user("BillBixby", "otherpass", "[email protected]")
        assert False, "Should have gotten a ConflictError"
    except ConflictError:
        s.rollback()
    s = _get_session(False)
    user = User.find_user("BillBixby")
    assert user.password == original_password, "Password should not have changed"
开发者ID:Jangts,项目名称:bespin,代码行数:15,代码来源:test_users.py

示例7: test_setup

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def test_setup(request, response):
    for name in test_users:
        user = User.find_user(name)
        if (user == None):
            user = User.create_user(name, name, name)
    response.body = ""
    response.content_type = "text/plain"
    return response()
开发者ID:Jangts,项目名称:bespin,代码行数:10,代码来源:controllers.py

示例8: test_create_new_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def test_create_new_user():
    s = _get_session(True)
    num_users = s.query(User).count()
    assert num_users == 0
    user = User.create_user("BillBixby", "hulkrulez", "[email protected]")
    assert len(user.uuid) == 36
    num_users = s.query(User).count()
    assert num_users == 1
开发者ID:bbrowning,项目名称:bespin_couch,代码行数:10,代码来源:test_users.py

示例9: get_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
 def get_user(name):
     user = User.find_user(name)
     if user == None:
         user = User.create_user(name, name, name + "@foo.com")
         session.commit()
         info("Created user called '" + name + "'")
     try:
         filesystem.get_project(user, user, "BespinSettings")
     except:
         settings = filesystem.get_project(user, user, "BespinSettings", create=True)
         settings.install_template('usertemplate')
         info("Created BespinSettings project for '" + name + "'")
     return user
开发者ID:rajeshpillai,项目名称:core-Wakanda,代码行数:15,代码来源:pavement.py

示例10: new_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def new_user(request, response):
    try:
        username = request.kwargs['username']
        email = request.POST['email']
        password = request.POST['password']
    except KeyError:
        raise BadRequest("username, email and password are required.")
    user = User.create_user(username, password, email)

    settings_project = get_project(user, user, "BespinSettings", create=True)
    settings_project.install_template('usertemplate')
    response.content_type = "application/json"
    response.body = "{}"
    request.environ['paste.auth_tkt.set_user'](username)
    return response()
开发者ID:Jangts,项目名称:bespin,代码行数:17,代码来源:controllers.py

示例11: test_create_new_user

# 需要导入模块: from bespin.database import User [as 别名]
# 或者: from bespin.database.User import create_user [as 别名]
def test_create_new_user():
    s = _get_session(True)
    num_users = s.query(User).count()
    assert num_users == 0
    user = User.create_user("BillBixby", "hulkrulez", "[email protected]")
    assert len(user.uuid) == 36
    num_users = s.query(User).count()
    assert num_users == 1
    result = s.connection().execute(EventLog.select()).fetchall()
    assert len(result) == 1
    
    users = User.find_by_email("[email protected]")
    assert users[0].username == "BillBixby"
    assert len(users) == 1
    
    user = User.find_user("[email protected]")
    assert user == users[0]
开发者ID:mozilla,项目名称:bespinserver,代码行数:19,代码来源:test_users.py


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