test_auth.py 文件源码

python
阅读 67 收藏 0 点赞 0 评论 0

项目:backend.ai-client-py 作者: lablup 项目源码 文件源码
def test_generate_signature(defconfig):
    kwargs = dict(
        method='GET',
        version=defconfig.version,
        endpoint=defconfig.endpoint,
        date=datetime.now(tzutc()),
        request_path='/path/to/api/',
        content=b'"test data"',
        content_type='application/json',
        access_key=defconfig.access_key,
        secret_key=defconfig.secret_key,
        hash_type='md5'
    )
    headers, signature = generate_signature(**kwargs)

    assert kwargs['hash_type'].upper() in headers['Authorization']
    assert kwargs['access_key'] in headers['Authorization']
    assert signature in headers['Authorization']
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号