本文整理匯總了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)