Пример #1
0
 def test_9(self):
     pcbms = []
     for i in range(3):
         pcbms.append(
             create_mock_full({"sig_pack()": bytes("pcbm %i" % i,
                                                   "ascii")}))
     inst = ASMarking(
         create_mock_full({
             "isdas": _ISD_AS1,
             "trcVer": 2,
             "certVer": 3,
             "ifIDSize": 4,
             "hashTreeRoot": b"root",
             "mtu": 1482,
             "chain": b"chain"
         }))
     inst.iter_pcbms = create_mock_full(return_value=pcbms)
     expected = b"".join([
         _ISD_AS1_BYTES,
         bytes.fromhex("00000002 00000003 04"), b"pcbm 0", b"pcbm 1",
         b"pcbm 2", b"root",
         bytes.fromhex("05ca"), b"chain"
     ])
     # Call
     ntools.eq_(inst.sig_pack(8), expected)
Пример #2
0
 def test_9(self):
     pcbms = []
     for i in range(3):
         pcbms.append(
             create_mock_full({"sig_pack()": bytes("pcbm %i" % i,
                                                   "ascii")}))
     exts = create_mock_full({"revInfos": [b"rev0", b"rev1"]})
     inst = ASMarking(
         create_mock_full({
             "isdas": "isdas",
             "trcVer": 2,
             "certVer": 3,
             "ifIDSize": 4,
             "egRevToken": b"eg rev",
             "exts": exts,
             "mtu": 1482,
             "chain": b"chain",
         }))
     inst.iter_pcbms = create_mock_full(return_value=pcbms)
     expected = b"".join([
         b"isdas",
         bytes.fromhex("00000002 00000003 04"), b"pcbm 0", b"pcbm 1",
         b"pcbm 2", b"eg rev", b"rev0", b"rev1",
         bytes.fromhex("05ca"), b"chain"
     ])
     # Call
     ntools.eq_(inst.sig_pack(9), expected)