summaryrefslogtreecommitdiff
path: root/OpenSSL/test/test_ssl.py
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSSL/test/test_ssl.py')
-rw-r--r--OpenSSL/test/test_ssl.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/OpenSSL/test/test_ssl.py b/OpenSSL/test/test_ssl.py
index e3518c5..a9b9890 100644
--- a/OpenSSL/test/test_ssl.py
+++ b/OpenSSL/test/test_ssl.py
@@ -700,15 +700,19 @@ class ContextTests(TestCase, _LoopbackMixin):
serverSSL = Connection(context, server)
serverSSL.set_accept_state()
- while not called:
- for ssl in clientSSL, serverSSL:
- try:
- ssl.do_handshake()
- except WantReadError:
- pass
+ handshake(clientSSL, serverSSL)
- # Kind of lame. Just make sure it got called somehow.
- self.assertTrue(called)
+ # The callback must always be called with a Connection instance as the
+ # first argument. It would probably be better to split this into
+ # separate tests for client and server side info callbacks so we could
+ # assert it is called with the right Connection instance. It would
+ # also be good to assert *something* about `where` and `ret`.
+ notConnections = [
+ conn for (conn, where, ret) in called
+ if not isinstance(conn, Connection)]
+ self.assertEqual(
+ [], notConnections,
+ "Some info callback arguments were not Connection instaces.")
def _load_verify_locations_test(self, *args):