當前位置: 首頁>>代碼示例>>Python>>正文


Python tests.BespinTestApp類代碼示例

本文整理匯總了Python中bespin.tests.BespinTestApp的典型用法代碼示例。如果您正苦於以下問題:Python BespinTestApp類的具體用法?Python BespinTestApp怎麽用?Python BespinTestApp使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了BespinTestApp類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_bad_login_yields_401

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,代碼行數:7,代碼來源:test_users.py

示例2: test_login_without_cookie

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,代碼行數:8,代碼來源:test_users.py

示例3: test_bad_ticket_is_ignored

def test_bad_ticket_is_ignored():
    _clear_db()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/new/Aldus", dict(password="foo", 
                                        email="[email protected]"))
    app.cookies['auth_tkt'] = app.cookies['auth_tkt'][:-1]
    resp = app.get("/preview/at/SampleProjectFor%3AAldus/index.html", status=401)
開發者ID:Jangts,項目名稱:bespin,代碼行數:8,代碼來源:test_users.py

示例4: test_static_files_with_auth

def test_static_files_with_auth():
    _clear_db()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.get('/editor.html', status=302)
    assert resp.location == "http://localhost/"
    resp = app.post('/register/new/Aldus', dict(password="foo", 
                                                email="[email protected]"))
    resp = app.get('/editor.html')
開發者ID:Jangts,項目名稱:bespin,代碼行數:9,代碼來源:test_users.py

示例5: test_userinfo_also_returns_capabilities

def test_userinfo_also_returns_capabilities():
    _clear_db()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/new/BillBixby", dict(email="[email protected]", password="notangry"))
    resp = app.get("/register/userinfo/")
    data = simplejson.loads(resp.body)
    print data
    assert "serverCapabilities" in data
開發者ID:joncv,項目名稱:bespin,代碼行數:9,代碼來源:test_config.py

示例6: test_server_capabilities

def test_server_capabilities():
    _clear_db()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/new/BillBixby", dict(email="[email protected]", password="notangry"))
    resp = app.get("/capabilities/")
    assert resp.content_type == "application/json"
    data = simplejson.loads(resp.body)
    print data
    assert data == dict(capabilities=["vcs"], dojoModulePath={}, javaScriptPlugins=[])
開發者ID:joncv,項目名稱:bespin,代碼行數:10,代碼來源:test_config.py

示例7: test_username_with_bad_characters

def test_username_with_bad_characters():
    _clear_db()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/new/Thinga%20Majig",
            dict(password="foo", email="[email protected]"), status=400)
    resp = app.post("/register/new/Thinga<majig>",
            dict(password="foo", email="[email protected]"), status=400)
    resp = app.post("/register/new/Thing/", 
                    dict(password="foo", email="[email protected]"), status=400)
    resp = app.post("/register/new/..", 
                    dict(password="foo", email="[email protected]"), status=400)
開發者ID:Jangts,項目名稱:bespin,代碼行數:12,代碼來源:test_users.py

示例8: test_register_existing_user_should_not_authenticate

def test_register_existing_user_should_not_authenticate():
    s = _get_session(True)
    app_orig = controllers.make_app()
    app = BespinTestApp(app_orig)
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    app = BespinTestApp(app_orig)
    resp = app.post("/register/new/BillBixby", dict(email="[email protected]",
                                                    password="somethingelse"),
                    status=409)
    assert not resp.cookies_set
    user = User.find_user("BillBixby", 'notangry')
    assert user is not None
開發者ID:Jangts,項目名稱:bespin,代碼行數:13,代碼來源:test_users.py

示例9: test_get_users_settings

def test_get_users_settings():
    _clear_db()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post("/register/new/macgyver",
        dict(password="foo", email="[email protected]"))
    resp = app.put("/file/at/BespinSettings/settings", """
vcsuser Mack Gyver <[email protected]>

""")
    s = _get_session()
    macgyver = User.find_user("macgyver")
    settings = macgyver.get_settings()
    assert settings == dict(vcsuser="Mack Gyver <[email protected]>")
開發者ID:Jangts,項目名稱:bespin,代碼行數:14,代碼來源:test_users.py

示例10: test_password_change_bad_code

def test_password_change_bad_code():
    config.set_profile("test")
    config.activate_profile()
    _clear_db()
    
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    app.reset()
    
    resp = app.post('/register/password/BillBixby', dict( 
                                            code="42",
                                            newPassword="hatetraffic"),
                    status=400)
    
開發者ID:Jangts,項目名稱:bespin,代碼行數:15,代碼來源:test_users.py

示例11: test_lost_username

def test_lost_username(send_text_email):
    config.set_profile("test")
    config.activate_profile()
    _clear_db()
    
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    
    resp = app.post('/register/lost/', dict(email='[email protected]'))
    assert send_text_email.called
    args = send_text_email.call_args[0]
    assert args[0] == '[email protected]'
    assert args[1].startswith("Your username for ")
    assert "Your username is:" in args[2]
    assert "BillBixby" in args[2]
開發者ID:Jangts,項目名稱:bespin,代碼行數:17,代碼來源:test_users.py

示例12: test_register_and_verify_user

def test_register_and_verify_user():
    config.activate_profile()
    _clear_db()
    s = _get_session()
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    assert resp.content_type == "application/json"
    data = simplejson.loads(resp.body)
    assert data == {}
    assert resp.cookies_set['auth_tkt']
    assert app.cookies
    billbixby = User.find_user("BillBixby")
    sample_project = get_project(billbixby, billbixby, "SampleProject")
    files = [file.name for file in sample_project.list_files()]
    assert "readme.txt" in files
    
    # should be able to run again without an exception appearing
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"),
                    status=409)
    
    # with the cookie set, we should be able to retrieve the 
    # logged in name
    resp = app.get('/register/userinfo/')
    assert resp.content_type == 'application/json'
    data = simplejson.loads(resp.body)
    assert data['username'] == 'BillBixby'
    assert 'quota' in data
    assert data['quota'] == 15728640
    assert 'amountUsed' in data
    
    resp = app.get("/file/at/BespinSettings/config")
    app.post("/file/close/BespinSettings/config")
開發者ID:Jangts,項目名稱:bespin,代碼行數:35,代碼來源:test_users.py

示例13: test_users_can_be_locked_out

def test_users_can_be_locked_out():
    config.set_profile("test")
    config.c.login_failure_tracking = "memory"
    config.c.login_attempts = "1"
    config.c.lockout_period = "1"
    config.activate_profile()
    app = controllers.make_app()
    app = BespinTestApp(app)
    _clear_db()
    
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    resp = app.post("/register/login/BillBixby",
        dict(password="NOTHULK"), status=401)
    
    # fail with good password now, because we're locked out
    resp = app.post("/register/login/BillBixby",
        dict(password="notangry"), status=401)
開發者ID:Jangts,項目名稱:bespin,代碼行數:18,代碼來源:test_users.py

示例14: test_password_change_with_confirmation_code

def test_password_change_with_confirmation_code():
    config.set_profile("test")
    config.activate_profile()
    _clear_db()
    
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    app.reset()
    
    user = User.find_user("BillBixby")
    verify_code = controllers._get_password_verify_code(user)
    resp = app.post('/register/password/BillBixby', dict( 
                                            code=verify_code,
                                            newPassword="hatetraffic"))
    
    user = User.find_user('BillBixby', 'hatetraffic')
    assert user
開發者ID:Jangts,項目名稱:bespin,代碼行數:19,代碼來源:test_users.py

示例15: test_lost_password_request

def test_lost_password_request(send_text_email):
    config.set_profile("test")
    config.activate_profile()
    _clear_db()
    
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.post('/register/new/BillBixby', dict(email="[email protected]",
                                                    password="notangry"))
    
    app.reset()
    resp = app.post('/register/lost/', dict(username='BillBixby'))
    assert send_text_email.called
    args = send_text_email.call_args[0]
    assert args[0] == '[email protected]'
    assert args[1].startswith("Requested password change for ")
    user = User.find_user("BillBixby")
    verify_code = controllers._get_password_verify_code(user)
    assert verify_code in args[2]
開發者ID:Jangts,項目名稱:bespin,代碼行數:19,代碼來源:test_users.py


注:本文中的bespin.tests.BespinTestApp類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。