aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-02-08 04:19:25 +0100
committerMaximilian Hils <git@maximilianhils.com>2016-02-08 04:19:25 +0100
commitbdb763d9cff75eec4bb44d23bfc2ef6fa4871bcc (patch)
treeea0f24bb4d8d655a9f982ff5e5cd2c36d5c10f4e /test
parente9934cc008417cb1aed694f7f24133abac0815eb (diff)
downloadmitmproxy-bdb763d9cff75eec4bb44d23bfc2ef6fa4871bcc.tar.gz
mitmproxy-bdb763d9cff75eec4bb44d23bfc2ef6fa4871bcc.tar.bz2
mitmproxy-bdb763d9cff75eec4bb44d23bfc2ef6fa4871bcc.zip
make stateobject simpler and stricter
Diffstat (limited to 'test')
-rw-r--r--test/test_flow.py6
-rw-r--r--test/tutils.py16
2 files changed, 16 insertions, 6 deletions
diff --git a/test/test_flow.py b/test/test_flow.py
index 68316f2a..51b88fff 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -422,7 +422,7 @@ class TestFlow(object):
assert not f == f2
f2.error = Error("e2")
assert not f == f2
- f.load_state(f2.get_state())
+ f.set_state(f2.get_state())
assert f.get_state() == f2.get_state()
def test_kill(self):
@@ -1204,7 +1204,7 @@ class TestError:
e2 = Error("bar")
assert not e == e2
- e.load_state(e2.get_state())
+ e.set_state(e2.get_state())
assert e.get_state() == e2.get_state()
e3 = e.copy()
@@ -1224,7 +1224,7 @@ class TestClientConnection:
assert not c == c2
c2.timestamp_start = 42
- c.load_state(c2.get_state())
+ c.set_state(c2.get_state())
assert c.timestamp_start == 42
c3 = c.copy()
diff --git a/test/tutils.py b/test/tutils.py
index 5bd91307..2ce0884d 100644
--- a/test/tutils.py
+++ b/test/tutils.py
@@ -76,7 +76,11 @@ def tclient_conn():
"""
c = ClientConnection.from_state(dict(
address=dict(address=("address", 22), use_ipv6=True),
- clientcert=None
+ clientcert=None,
+ ssl_established=False,
+ timestamp_start=1,
+ timestamp_ssl_setup=2,
+ timestamp_end=3,
))
c.reply = controller.DummyReply()
return c
@@ -88,9 +92,15 @@ def tserver_conn():
"""
c = ServerConnection.from_state(dict(
address=dict(address=("address", 22), use_ipv6=True),
- state=[],
source_address=dict(address=("address", 22), use_ipv6=True),
- cert=None
+ cert=None,
+ timestamp_start=1,
+ timestamp_tcp_setup=2,
+ timestamp_ssl_setup=3,
+ timestamp_end=4,
+ ssl_established=False,
+ sni="address",
+ via=None
))
c.reply = controller.DummyReply()
return c