本文整理汇总了Python中relengapi.blueprints.tokenauth.util.FakeSerializer.usr方法的典型用法代码示例。如果您正苦于以下问题:Python FakeSerializer.usr方法的具体用法?Python FakeSerializer.usr怎么用?Python FakeSerializer.usr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类relengapi.blueprints.tokenauth.util.FakeSerializer
的用法示例。
在下文中一共展示了FakeSerializer.usr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assert_usr_token
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import usr [as 别名]
def assert_usr_token(data, **attrs):
token = _get_token(data)
attrs['typ'] = 'usr'
attrs['id'] = id = token.id
attrs['token'] = FakeSerializer.usr(id)
attrs['disabled'] = False
_eq_token(token, attrs)
示例2: test_query_usr_token_success_all
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import usr [as 别名]
def test_query_usr_token_success_all(client):
"""Querying a user token with base.tokens.usr.view.all returns the token."""
res = client.post_json('/tokenauth/tokens/query',
FakeSerializer.usr(2))
eq_(json.loads(res.data), {'result': usr_json})
示例3: test_query_usr_token_forbidden_not_mine
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import usr [as 别名]
def test_query_usr_token_forbidden_not_mine(client):
"""Querying a user token with base.tokens.usr.view.my gives 403
if the token email doesn't match the request email"""
res = client.post_json('/tokenauth/tokens/query',
FakeSerializer.usr(2))
eq_(res.status_code, 403)
示例4: test_query_usr_token_forbidden
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import usr [as 别名]
def test_query_usr_token_forbidden(client):
"""Querying a user token without permission results in a 403"""
res = client.post_json('/tokenauth/tokens/query',
FakeSerializer.usr(2))
eq_(res.status_code, 403)
示例5: test_query_usr_token_success_mine
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import usr [as 别名]
def test_query_usr_token_success_mine(client):
"""Querying a user token with base.tokens.usr.view.my returns the
token if the emails match"""
res = client.post_json('/tokenauth/tokens/query',
FakeSerializer.usr(2))
assert_result(res.data, usr_json)