本文整理汇总了Python中relengapi.blueprints.tokenauth.util.FakeSerializer.tmp方法的典型用法代码示例。如果您正苦于以下问题:Python FakeSerializer.tmp方法的具体用法?Python FakeSerializer.tmp怎么用?Python FakeSerializer.tmp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类relengapi.blueprints.tokenauth.util.FakeSerializer
的用法示例。
在下文中一共展示了FakeSerializer.tmp方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: assert_tmp_token
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import tmp [as 别名]
def assert_tmp_token(data, **attrs):
token = _get_token(data)
attrs['typ'] = 'tmp'
attrs['disabled'] = False
nbf = JAN_2014
exp = calendar.timegm(token.expires.utctimetuple())
attrs['token'] = FakeSerializer.tmp(
nbf=nbf, exp=exp, prm=token.permissions,
mta=token.metadata)
_eq_token(token, attrs)
示例2: test_query_tmp_token
# 需要导入模块: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 别名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import tmp [as 别名]
def test_query_tmp_token(client):
"""Querying a temporary token returns that token's info,
without requiring any special permissions"""
tok = FakeSerializer.tmp(
nbf=946684800, # Jan 1, 2000
exp=32503680000, # Jan 1, 3000
prm=['test_tokenauth.zag'],
mta={})
res = client.post_json('/tokenauth/tokens/query', tok)
eq_(res.status_code, 200)
assert_result(res.data, {
'typ': 'tmp',
'not_before': '2000-01-01T00:00:00+00:00',
'expires': '3000-01-01T00:00:00+00:00',
'metadata': {},
'permissions': ['test_tokenauth.zag'],
'disabled': False,
})