diff options
Diffstat (limited to 'test/test_tcp.py')
-rw-r--r-- | test/test_tcp.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_tcp.py b/test/test_tcp.py index 9c15e2eb..4e27a632 100644 --- a/test/test_tcp.py +++ b/test/test_tcp.py @@ -2,6 +2,7 @@ import cStringIO, Queue, time, socket, random from netlib import tcp, certutils, test import mock import tutils +from OpenSSL import SSL class SNIHandler(tcp.BaseHandler): sni = None @@ -435,3 +436,22 @@ class TestFileLike: s.readline() assert s.first_byte_timestamp == expected + def test_read_ssl_error(self): + s = cStringIO.StringIO("foobar\nfoobar") + s = mock.MagicMock() + s.read = mock.MagicMock(side_effect=SSL.Error()) + s = tcp.Reader(s) + tutils.raises(tcp.NetLibSSLError, s.read, 1) + + + +class TestAddress: + def test_simple(self): + a = tcp.Address("localhost", True) + assert a.use_ipv6 + b = tcp.Address("foo.com", True) + assert not a == b + c = tcp.Address("localhost", True) + assert a == c + + |