test_utils.py 文件源码

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

项目:options-screener 作者: dcwangmit01 项目源码 文件源码
def test_ceph_key(self, mock_urandom):
        result = utils.JinjaUtils.ceph_key()

        # First, decode the base64
        raw_result = base64.b64decode(result.encode('ascii'))

        # Decompose into a header and a key
        hdr_struct = struct.Struct('<hiih')
        header = raw_result[:hdr_struct.size]
        key = raw_result[hdr_struct.size:]

        # Interpret the header
        _type, _secs, _nanosecs, key_len = hdr_struct.unpack(header)
        assert key_len == len(key)

        # Verify that the key is what it should be
        assert key == b'0123456789012345'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号