本文整理汇总了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")
示例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')
示例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)
示例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
示例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'] == '""'
示例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=[])
示例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 == ""
示例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"