def test_correctly_encodes_sct_list_multiple_scts(self):
    first_sct = tls_message.encode(self._sct_proto)
    sct_proto_2 = client_pb2.SignedCertificateTimestamp()
    sct_proto_2.CopyFrom(self._sct_proto)
    sct_proto_2.timestamp = 1365427530000
    second_sct = tls_message.encode(sct_proto_2)
    sct_list = client_pb2.SignedCertificateTimestampList()
    sct_list.sct_list.extend([first_sct, second_sct])
    encoded_sct_list = tls_message.encode(sct_list)
    self.assertEqual(encoded_sct_list[:4], '00f00076'.decode('hex'))
    first_sct_end = (len(first_sct) + 4)
    self.assertEqual(encoded_sct_list[4:first_sct_end], first_sct)
    self.assertEqual(encoded_sct_list[first_sct_end:(first_sct_end + 2)], '0076'.decode('hex'))
    self.assertEqual(encoded_sct_list[(first_sct_end + 2):], second_sct)
def test_correctly_encodes_sct_list_multiple_scts(self):
    first_sct = tls_message.encode(self._sct_proto)
    sct_proto_2 = client_pb2.SignedCertificateTimestamp()
    sct_proto_2.CopyFrom(self._sct_proto)
    sct_proto_2.timestamp = 1365427530000
    second_sct = tls_message.encode(sct_proto_2)
    sct_list = client_pb2.SignedCertificateTimestampList()
    sct_list.sct_list.extend([first_sct, second_sct])
    encoded_sct_list = tls_message.encode(sct_list)
    self.assertEqual(encoded_sct_list[:4], '00f00076'.decode('hex'))
    first_sct_end = (len(first_sct) + 4)
    self.assertEqual(encoded_sct_list[4:first_sct_end], first_sct)
    self.assertEqual(encoded_sct_list[first_sct_end:(first_sct_end + 2)], '0076'.decode('hex'))
    self.assertEqual(encoded_sct_list[(first_sct_end + 2):], second_sct)