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


Python BespinTestApp.get方法代码示例

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


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

示例1: test_register_and_verify_user

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
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,代码行数:37,代码来源:test_users.py

示例2: test_static_files_with_auth

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
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,代码行数:11,代码来源:test_users.py

示例3: test_bad_ticket_is_ignored

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
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,代码行数:10,代码来源:test_users.py

示例4: test_userinfo_also_returns_capabilities

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
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,代码行数:11,代码来源:test_config.py

示例5: test_logout

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
def test_logout():
    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'))
    resp = app.get("/register/logout/")
    assert resp.cookies_set['auth_tkt'] == '""'
开发者ID:Jangts,项目名称:bespin,代码行数:11,代码来源:test_users.py

示例6: test_server_capabilities

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
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,代码行数:12,代码来源:test_config.py

示例7: test_register_returns_empty_when_not_logged_in

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
def test_register_returns_empty_when_not_logged_in():
    app = controllers.make_app()
    app = BespinTestApp(app)
    resp = app.get('/register/userinfo/', status=401)
    assert resp.body == ""
开发者ID:Jangts,项目名称:bespin,代码行数:7,代码来源:test_users.py

示例8: test_api_version_header

# 需要导入模块: from bespin.tests import BespinTestApp [as 别名]
# 或者: from bespin.tests.BespinTestApp import get [as 别名]
def test_api_version_header():
    app = controllers.make_app()
    app = BespinTestApp(app)    
    resp = app.get("/register/userinfo/", status=401)
    assert resp.headers.get("X-Bespin-API") == "dev"
开发者ID:Jangts,项目名称:bespin,代码行数:7,代码来源:test_users.py


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