aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-03-14 01:36:36 +0100
committerMaximilian Hils <git@maximilianhils.com>2017-03-14 17:08:40 +0100
commit375680a3be47b7dd7b94ebd376978d9e4d90abcd (patch)
tree2e2f8f02ab6192818411455f87eac118e4019eef /test
parente29cd7f5b7a5547b23dd6626143f718546e63457 (diff)
downloadmitmproxy-375680a3be47b7dd7b94ebd376978d9e4d90abcd.tar.gz
mitmproxy-375680a3be47b7dd7b94ebd376978d9e4d90abcd.tar.bz2
mitmproxy-375680a3be47b7dd7b94ebd376978d9e4d90abcd.zip
add connection ids
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_connections.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/mitmproxy/test_connections.py b/test/mitmproxy/test_connections.py
index 0083f57c..57fdd8c7 100644
--- a/test/mitmproxy/test_connections.py
+++ b/test/mitmproxy/test_connections.py
@@ -66,8 +66,17 @@ class TestClientConnection:
assert c.timestamp_start == 42
c3 = c.copy()
+ assert c3.get_state() != c.get_state()
+ c.id = c3.id = "foo"
assert c3.get_state() == c.get_state()
+ def test_eq(self):
+ c = tflow.tclient_conn()
+ c2 = c.copy()
+ assert c == c
+ assert c != c2
+ assert c != 42
+ assert hash(c) != hash(c2)
class TestServerConnection:
@@ -147,6 +156,21 @@ class TestServerConnection:
with pytest.raises(ValueError, matches='sni must be str, not '):
c.establish_ssl(None, b'foobar')
+ def test_state(self):
+ c = tflow.tserver_conn()
+ c2 = c.copy()
+ assert c2.get_state() != c.get_state()
+ c.id = c2.id = "foo"
+ assert c2.get_state() == c.get_state()
+
+ def test_eq(self):
+ c = tflow.tserver_conn()
+ c2 = c.copy()
+ assert c == c
+ assert c != c2
+ assert c != 42
+ assert hash(c) != hash(c2)
+
class TestClientConnectionTLS: