From bdb62101bbbd4babc3099dd71424f85676866161 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Thu, 28 May 2015 17:45:54 +0200 Subject: test Address __str__ --- test/test_tcp.py | 1 + 1 file changed, 1 insertion(+) (limited to 'test/test_tcp.py') diff --git a/test/test_tcp.py b/test/test_tcp.py index ef00e029..2bf492fa 100644 --- a/test/test_tcp.py +++ b/test/test_tcp.py @@ -603,6 +603,7 @@ class TestAddress: assert a.use_ipv6 b = tcp.Address("foo.com", True) assert not a == b + assert str(b) == str(tuple("foo.com")) c = tcp.Address("localhost", True) assert a == c assert not a != c -- cgit v1.2.3 From 780836b182cd982b978f16218299f2b77a8ed204 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Thu, 28 May 2015 17:46:44 +0200 Subject: add ALPN support to TCP abstraction --- test/test_tcp.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test/test_tcp.py') diff --git a/test/test_tcp.py b/test/test_tcp.py index 2bf492fa..ab786d3f 100644 --- a/test/test_tcp.py +++ b/test/test_tcp.py @@ -389,6 +389,24 @@ class TestTimeOut(test.ServerTestBase): tutils.raises(tcp.NetLibTimeout, c.rfile.read, 10) +class TestALPN(test.ServerTestBase): + handler = HangHandler + ssl = dict( + cert=tutils.test_data.path("data/server.crt"), + key=tutils.test_data.path("data/server.key"), + request_client_cert=False, + v3_only=False, + alpn_select="h2" + ) + + def test_alpn(self): + c = tcp.TCPClient(("127.0.0.1", self.port)) + c.connect() + c.convert_to_ssl(alpn_protos=["h2"]) + print "ALPN: %s" % c.get_alpn_proto_negotiated() + assert c.get_alpn_proto_negotiated() == "h2" + + class TestSSLTimeOut(test.ServerTestBase): handler = HangHandler ssl = dict( -- cgit v1.2.3 From 629fa8e5528783501e402a7e33ac6199bb38ece6 Mon Sep 17 00:00:00 2001 From: Thomas Kriechbaumer Date: Fri, 29 May 2015 17:04:12 +0200 Subject: make tests aware of ALPN & OpenSSL 1.0.2 dependency --- test/test_tcp.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'test/test_tcp.py') diff --git a/test/test_tcp.py b/test/test_tcp.py index ab786d3f..62617707 100644 --- a/test/test_tcp.py +++ b/test/test_tcp.py @@ -4,11 +4,14 @@ import time import socket import random import os -from netlib import tcp, certutils, test, certffi import threading import mock -import tutils + from OpenSSL import SSL +import OpenSSL + +from netlib import tcp, certutils, test, certffi +import tutils class EchoHandler(tcp.BaseHandler): @@ -399,12 +402,14 @@ class TestALPN(test.ServerTestBase): alpn_select="h2" ) - def test_alpn(self): - c = tcp.TCPClient(("127.0.0.1", self.port)) - c.connect() - c.convert_to_ssl(alpn_protos=["h2"]) - print "ALPN: %s" % c.get_alpn_proto_negotiated() - assert c.get_alpn_proto_negotiated() == "h2" + if OpenSSL._util.lib.Cryptography_HAS_ALPN: + + def test_alpn(self): + c = tcp.TCPClient(("127.0.0.1", self.port)) + c.connect() + c.convert_to_ssl(alpn_protos=["h2"]) + print "ALPN: %s" % c.get_alpn_proto_negotiated() + assert c.get_alpn_proto_negotiated() == "h2" class TestSSLTimeOut(test.ServerTestBase): -- cgit v1.2.3