本文整理汇总了Python中libraries.testkit.admin.Admin.get_role方法的典型用法代码示例。如果您正苦于以下问题:Python Admin.get_role方法的具体用法?Python Admin.get_role怎么用?Python Admin.get_role使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libraries.testkit.admin.Admin
的用法示例。
在下文中一共展示了Admin.get_role方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: rest_scan
# 需要导入模块: from libraries.testkit.admin import Admin [as 别名]
# 或者: from libraries.testkit.admin.Admin import get_role [as 别名]
def rest_scan(sync_gateway, db, online, num_docs, user_name, channels):
# Missing ADMIN
# TODO: GET /{db}/_session/{session-id}
# TODO: POST /{db}/_session
# TODO: DELETE /{db}/_session/{session-id}
# TODO: DELETE /{db}/_user/{name}/_session/{session-id}
# TODO: DELETE /{db}/_user/{name}/_session
# TODO: DELETE /{db}/_user/{name}
# TODO: POST /{db}/_role/
# TODO: DELETE /{db}/_role/{name}
# Missing REST
# TODO: POST /{db}/_all_docs
# TODO: DELETE /{db}/{doc}
# TODO: PUT /{db}/{doc}/{attachment}
# TODO: GET /{db}/{doc}/{attachment}
# Missing Local Document
# TODO: DELETE /{db}/{local-doc-id}
# Missing Authentication
# TODO: POST /{db}/_facebook_token
admin = Admin(sync_gateway=sync_gateway)
error_responses = list()
# PUT /{db}/_role/{name}
try:
admin.create_role(db=db, name="radio_stations", channels=["HWOD", "KDWB"])
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# GET /{db}/_role
try:
roles = admin.get_roles(db=db)
log_info(roles)
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# GET /{db}/_role/{name}
try:
role = admin.get_role(db=db, name="radio_stations")
log_info(role)
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# PUT /{db}/_user/{name}
try:
user = admin.register_user(target=sync_gateway, db=db, name=user_name, password="password", channels=channels)
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# GET /{db}/_user
try:
users_info = admin.get_users_info(db=db)
log_info(users_info)
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# GET /{db}/_user/{name}
try:
user_info = admin.get_user_info(db=db, name=user_name)
log_info(user_info)
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# GET /{db}
try:
db_info = admin.get_db_info(db=db)
if not online:
assert db_info["state"] == "Offline"
else:
assert db_info["state"] == "Online"
log_info(db_info)
except HTTPError as e:
log_info((e.response.url, e.response.status_code))
error_responses.append((e.response.url, e.response.status_code))
# Create dummy user to hit endpoint if offline, user creation above will fail
if not online:
user = User(target=sync_gateway, db=db, name=user_name, password="password", channels=channels)
# PUT /{db}/{name}
add_docs_errors = user.add_docs(num_docs=num_docs)
error_responses.extend(add_docs_errors)
# POST /{db}/_bulk_docs
bulk_doc_errors = user.add_docs(num_docs=num_docs, bulk=True)
error_responses.extend(bulk_doc_errors)
#.........这里部分代码省略.........