':py:obj:`Connection.get_peer_cert_chain` returns a list of certificates which
the connected server returned for the certification verification.'

def test_get_peer_cert_chain(self):

    chain = _create_certificate_chain()
    [(cakey, cacert), (ikey, icert), (skey, scert)] = chain
    serverContext = Context(TLSv1_METHOD)
    serverContext.use_privatekey(skey)
    serverContext.use_certificate(scert)
    serverContext.add_extra_chain_cert(icert)
    serverContext.add_extra_chain_cert(cacert)
    server = Connection(serverContext, None)
    server.set_accept_state()
    clientContext = Context(TLSv1_METHOD)
    clientContext.set_verify(VERIFY_NONE, verify_cb)
    client = Connection(clientContext, None)
    client.set_connect_state()
    self._interactInMemory(client, server)
    chain = client.get_peer_cert_chain()
    self.assertEqual(len(chain), 3)
    self.assertEqual('Server    Certificate', chain[0].get_subject().CN)
    self.assertEqual('Intermediate    Certificate', chain[1].get_subject().CN)
    self.assertEqual('Authority    Certificate', chain[2].get_subject().CN)
