本文整理汇总了Python中pytest_ringo.login函数的典型用法代码示例。如果您正苦于以下问题:Python login函数的具体用法?Python login怎么用?Python login使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了login函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_POST_existing_group
def test_POST_existing_group(self, app):
# FIXME: https://github.com/ringo-framework/ringo/issues/4 (ti) <2016-01-18 16:46>
login(app, "admin", "secret")
transaction_begin(app)
values = {"name": "admins"}
app.post("/usergroups/create", params=values, status=200)
transaction_rollback(app)
示例2: test_delete_POST_admin_confirm_yes
def test_delete_POST_admin_confirm_yes(self, app):
"""Admin user can not delete himself. This triggers a circular
dependecy which is handled with the fix of #5"""
login(app, "admin", "secret")
transaction_begin(app)
values = {"confirmed": 1}
app.post("/users/delete/1", params=values, status=200)
示例3: test_delete_POST_admin_confirm_yes
def test_delete_POST_admin_confirm_yes(self, app):
# FIXME: https://github.com/ringo-framework/ringo/issues/5 (ti) <2016-01-18 16:46>
login(app, "admin", "secret")
transaction_begin(app)
values = {"confirmed": 1}
app.post("/usergroups/delete/1", params=values, status=302)
transaction_rollback(app)
示例4: test_update_POST_missing_label_plural
def test_update_POST_missing_label_plural(self, app):
login(app, "admin", "secret")
transaction_begin(app)
values = {"name": "modules", "label": "Modul",
"label_plural": ""}
app.post("/modules/update/1", params=values, status=200)
transaction_rollback(app)
示例5: test_change_password_tooshort
def test_change_password_tooshort(self, app):
login(app, "admin", "secret")
transaction_begin(app)
values = {"login": "admin", "oldpassword": "secret",
"password": "123123123",
"_retype_password": "123123123"}
result = app.post("/users/changepassword/1", params=values, status=200)
transaction_rollback(app)
示例6: test_delete_POST_admin_confirm_yes
def test_delete_POST_admin_confirm_yes(self, app):
"""admin user group can not be deleted see
https://github.com/ringo-framework/ringo/issues/5 for more
details."""
login(app, "admin", "secret")
transaction_begin(app)
values = {"confirmed": 1}
app.post("/usergroups/delete/1", params=values, status=200)
transaction_rollback(app)
示例7: test_POST
def test_POST(self, app):
login(app, "admin", "secret")
transaction_begin(app)
create_user(app, "test")
udata = search_data(app, "users", "login", "test")
gdata = search_data(app, "usergroups", "name", "test")
# Check that the default_gid is set to the users usergroup
assert gdata.get("id") == udata.get("default_gid")
transaction_rollback(app)
示例8: test_POST_existing_user
def test_POST_existing_user(self, app):
login(app, "admin", "secret")
transaction_begin(app)
values = {"login": "admin",
"password": "123123123qwe",
"_retype_password": "123123123qwe",
"_first_name": u"Först", "_last_name": "Last",
"_email": "[email protected]"}
app.post("/users/create", params=values, status=200)
transaction_rollback(app)
示例9: test_create
def test_create(self, app):
login(app, "admin", "secret")
transaction_begin(app)
create_user(app, "test")
user = search_data(app, "users", "login", "test")
user["login"] = "test123"
app.post("/users/update/%s" % user["id"], params=user, status=302)
usergroup = search_data(app, "usergroups", "name", user["login"])
assert usergroup
app.get("/")
transaction_rollback(app)
示例10: test_remove_permission
def test_remove_permission(self, app):
login(app, "admin", "secret")
transaction_begin(app)
values = {"label": "Users", "name": "user", "permissions": [21,30],
"admin": "False"}
app.post("/roles/update/1", params=values, status=302)
values = {"label": "Users", "name": "user", "permissions": [21],
"admin": "False"}
app.post("/roles/update/1", params=values, status=302)
transaction_rollback(app)
示例11: test_unauthorized
def test_unauthorized(self, app):
"""Method is called with a different uid than the id uf the
current user. This is not allowed the users are only allowed to
delete their own account."""
login(app, "admin", "secret")
transaction_begin(app)
create_user(app, "test")
user = search_data(app, "users", "login", "test")
app.get("/users/removeaccount/%s" % user["id"], params=user, status=403)
app.get("/")
transaction_rollback(app)
示例12: test_delete_POST_confirm_yes
def test_delete_POST_confirm_yes(self, app):
"""Test if a created user can be deleted. The transaction is not
actived here. As this seems to cause errors"""
login(app, "admin", "secret")
values = {"login": "test",
"password": "123123123qwe",
"_retype_password": "123123123qwe",
"_first_name": u"Först", "_last_name": "Last",
"_email": "[email protected]"}
result = app.post("/users/create", params=values, status=302)
id = result.headers["Location"].split("/")[-1]
values = {"confirmed": 1}
app.post("/users/delete/%s" % id, params=values, status=302)
示例13: test_delete
def test_delete(self, app):
login(app, "admin", "secret")
transaction_begin(app)
values = {"login": "test",
"password": "123123123qwe",
"_retype_password": "123123123qwe",
"_first_name": u"Först", "_last_name": "Last",
"_email": "[email protected]"}
result = app.post("/users/create", params=values, status=302)
id = result.headers["Location"].split("/")[-1]
app.get("/users/delete/%s" % id)
app.get("/users/list")
transaction_rollback(app)
示例14: test_confirmed
def test_confirmed(self, app):
"""User must confirm the deletion twice"""
transaction_begin(app)
login(app, "admin", "secret")
create_user(app, "test")
user = search_data(app, "users", "login", "test")
login(app, "test", "123123123qwe")
app.get("/users/removeaccount/%s" % user["id"], status=200)
params = {"_confirm_remove_account2": ["1"], "_confirm_remove_account": ["1"]}
app.post("/users/removeaccount/%s" % user["id"], params=params, status=302)
app.get("/")
transaction_rollback(app)
示例15: test_update_POST_missing_title
def test_update_POST_missing_title(self, app):
login(app, "admin", "secret")
transaction_begin(app)
values = {"title": "", "definiton": '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'}
app.post("/forms/update/1", params=values, status=200)
transaction_rollback(app)