aboutsummaryrefslogtreecommitdiffstats
path: root/test/netlib
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2016-07-21 19:49:32 -0700
committerMaximilian Hils <git@maximilianhils.com>2016-07-21 19:49:32 -0700
commit798759d2b3974eaa7afbaab7c9678e8f66dc1be6 (patch)
tree05612244e60bb091f95812a857652ae2fe8f87fd /test/netlib
parentdaae51823de79ca728e32d7925e239231c85e442 (diff)
downloadmitmproxy-798759d2b3974eaa7afbaab7c9678e8f66dc1be6.tar.gz
mitmproxy-798759d2b3974eaa7afbaab7c9678e8f66dc1be6.tar.bz2
mitmproxy-798759d2b3974eaa7afbaab7c9678e8f66dc1be6.zip
fix content view cache invalidation
Diffstat (limited to 'test/netlib')
-rw-r--r--test/netlib/http/test_message.py4
-rw-r--r--test/netlib/test_multidict.py14
2 files changed, 13 insertions, 5 deletions
diff --git a/test/netlib/http/test_message.py b/test/netlib/http/test_message.py
index deebd6f2..7f93830e 100644
--- a/test/netlib/http/test_message.py
+++ b/test/netlib/http/test_message.py
@@ -71,10 +71,6 @@ class TestMessage(object):
assert resp != 0
- def test_hash(self):
- resp = tresp()
- assert hash(resp)
-
def test_serializable(self):
resp = tresp()
resp2 = http.Response.from_state(resp.get_state())
diff --git a/test/netlib/test_multidict.py b/test/netlib/test_multidict.py
index 038441e7..58ae0f98 100644
--- a/test/netlib/test_multidict.py
+++ b/test/netlib/test_multidict.py
@@ -45,7 +45,7 @@ class TestMultiDict(object):
assert md["foo"] == "bar"
with tutils.raises(KeyError):
- md["bar"]
+ assert md["bar"]
md_multi = TMultiDict(
[("foo", "a"), ("foo", "b")]
@@ -101,6 +101,15 @@ class TestMultiDict(object):
assert TMultiDict() != self._multi()
assert TMultiDict() != 42
+ def test_hash(self):
+ """
+ If a class defines mutable objects and implements an __eq__() method,
+ it should not implement __hash__(), since the implementation of hashable
+ collections requires that a key's hash value is immutable.
+ """
+ with tutils.raises(TypeError):
+ assert hash(TMultiDict())
+
def test_get_all(self):
md = self._multi()
assert md.get_all("foo") == ["bar"]
@@ -197,6 +206,9 @@ class TestImmutableMultiDict(object):
with tutils.raises(TypeError):
md.add("foo", "bar")
+ def test_hash(self):
+ assert hash(TImmutableMultiDict())
+
def test_with_delitem(self):
md = TImmutableMultiDict([("foo", "bar")])
assert md.with_delitem("foo").fields == ()