當前位置: 首頁>>代碼示例>>Python>>正文


Python FakeSerializer.prm方法代碼示例

本文整理匯總了Python中relengapi.blueprints.tokenauth.util.FakeSerializer.prm方法的典型用法代碼示例。如果您正苦於以下問題:Python FakeSerializer.prm方法的具體用法?Python FakeSerializer.prm怎麽用?Python FakeSerializer.prm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在relengapi.blueprints.tokenauth.util.FakeSerializer的用法示例。


在下文中一共展示了FakeSerializer.prm方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_loader_good_header

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def test_loader_good_header(app, client):
    """With a good Authorization header, the permissions in the DB are allowed"""
    tok = FakeSerializer.prm(1)
    auth = json.loads(
        client.get('/test_tokenauth',
                   headers=[('Authorization', 'Bearer ' + tok)]).data)
    eq_(auth['permissions'], ['test_tokenauth.zig'], auth)
開發者ID:acmiyaguchi,項目名稱:build-relengapi,代碼行數:9,代碼來源:test_loader.py

示例2: assert_prm_token

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def assert_prm_token(data, **attrs):
    token = _get_token(data)
    attrs['typ'] = 'prm'
    attrs['id'] = id = token.id
    attrs['token'] = FakeSerializer.prm(id)
    attrs['disabled'] = False
    _eq_token(token, attrs)
開發者ID:b10n1k,項目名稱:build-relengapi,代碼行數:9,代碼來源:test_tokenauth.py

示例3: test_loader_good_header_Authentication

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def test_loader_good_header_Authentication(app, client):
    """The old 'Authentication' header can be used instead of 'Authorization'"""
    # see https://github.com/mozilla/build-relengapi/pull/192/files
    tok = FakeSerializer.prm(1)
    auth = json.loads(
        client.get('/test_tokenauth',
                   headers=[('Authentication', 'Bearer ' + tok)]).data)
    eq_(auth['permissions'], ['test_tokenauth.zig'], auth)
開發者ID:acmiyaguchi,項目名稱:build-relengapi,代碼行數:10,代碼來源:test_loader.py

示例4: test_query_prm_token_exists

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def test_query_prm_token_exists(client):
    """Querying a permanent token, with base.tokens.prm.view, returns that token."""
    res = client.post_json('/tokenauth/tokens/query',
                           FakeSerializer.prm(1))
    eq_(res.status_code, 200)
    eq_(json.loads(res.data),
        {'result': {'id': 1, 'description': 'Zig only', 'typ': 'prm',
                    'permissions': ['test_tokenauth.zig'],
                    'disabled': False}})
開發者ID:b10n1k,項目名稱:build-relengapi,代碼行數:11,代碼來源:test_tokenauth.py

示例5: test_from_str

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def test_from_str(app):
    """from_str returns a TokenUser object for a good token"""
    tok = FakeSerializer.prm(1)
    with app.app_context():
        eq_(loader.token_loader.from_str(tok).permissions,
            set([p.test_tokenauth.zig]))
開發者ID:acmiyaguchi,項目名稱:build-relengapi,代碼行數:8,代碼來源:test_loader.py

示例6: test_query_token_missing

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def test_query_token_missing(client):
    """Querying a permanent token that does not exist returns status 404"""
    res = client.post_json('/tokenauth/tokens/query',
                           FakeSerializer.prm(99))
    eq_(res.status_code, 404)
開發者ID:b10n1k,項目名稱:build-relengapi,代碼行數:7,代碼來源:test_tokenauth.py

示例7: test_query_prm_token_forbidden_wrong_perm

# 需要導入模塊: from relengapi.blueprints.tokenauth.util import FakeSerializer [as 別名]
# 或者: from relengapi.blueprints.tokenauth.util.FakeSerializer import prm [as 別名]
def test_query_prm_token_forbidden_wrong_perm(client):
    """Querying a permanent token requires base.tokens.prm.view"""
    res = client.post_json('/tokenauth/tokens/query',
                           FakeSerializer.prm(1))
    eq_(res.status_code, 403)
開發者ID:b10n1k,項目名稱:build-relengapi,代碼行數:7,代碼來源:test_tokenauth.py


注:本文中的relengapi.blueprints.tokenauth.util.FakeSerializer.prm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。