def test(self, get_type): inst = SCIONCommonHdr() inst.dst_addr_type = 0b111111 inst.src_addr_type = 0b000000 inst.version = 0b1111 inst.total_len = 0x304 inst.hdr_len = 0x8 inst._iof_idx = 3 inst._hof_idx = 4 inst.next_hdr = 0x7 addr_type = create_mock(['name']) addr_type.name.return_value = "name" get_type.return_value = addr_type # Call str(inst)
def test(self): inst = SCIONCommonHdr() inst.version = 0b1111 inst.dst_addr_type = 0b000000 inst.src_addr_type = 0b111111 inst.addrs_len = 24 inst.total_len = 0x0304 inst.hdr_len = 0x08 inst._iof_idx = 0x03 inst._hof_idx = 0x04 inst.next_hdr = 0x07 expected = b"".join([ bytes([0b11110000, 0b00111111]), bytes.fromhex('0304 08 38 40 07'), ]) # Call ntools.eq_(inst.pack(), expected)