aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_odict.py8
-rw-r--r--test/test_tcp.py20
2 files changed, 20 insertions, 8 deletions
diff --git a/test/test_odict.py b/test/test_odict.py
index 26bff357..cdbb4f39 100644
--- a/test/test_odict.py
+++ b/test/test_odict.py
@@ -41,14 +41,6 @@ class TestODict:
assert h.match_re("two: due")
assert not h.match_re("nonono")
- def test_getset_state(self):
- self.od.add("foo", 1)
- self.od.add("foo", 2)
- self.od.add("bar", 3)
- state = self.od._get_state()
- nd = odict.ODict._from_state(state)
- assert nd == self.od
-
def test_in_any(self):
self.od["one"] = ["atwoa", "athreea"]
assert self.od.in_any("one", "two")
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
+
+