aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_flow.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2012-07-09 09:54:15 +1200
committerAldo Cortesi <aldo@nullcube.com>2012-07-09 09:54:15 +1200
commit4b6fdc92dc43d7d300723594d62094d26f68f31e (patch)
tree55d3149dd9ab47d6ee43723b734f2b9f409102fc /test/test_flow.py
parent097b566e54fa8b2138891fc9d1458bdd42ae7c28 (diff)
downloadmitmproxy-4b6fdc92dc43d7d300723594d62094d26f68f31e.tar.gz
mitmproxy-4b6fdc92dc43d7d300723594d62094d26f68f31e.tar.bz2
mitmproxy-4b6fdc92dc43d7d300723594d62094d26f68f31e.zip
Remove ODict tests. ODict is now in netlib.
Diffstat (limited to 'test/test_flow.py')
-rw-r--r--test/test_flow.py111
1 files changed, 0 insertions, 111 deletions
diff --git a/test/test_flow.py b/test/test_flow.py
index 1dd44dd2..170b16bb 100644
--- a/test/test_flow.py
+++ b/test/test_flow.py
@@ -961,117 +961,6 @@ class TestClientConnect:
assert c3 == c
-class TestODict:
- def setUp(self):
- self.od = flow.ODict()
-
- def test_str_err(self):
- h = flow.ODict()
- tutils.raises(ValueError, h.__setitem__, "key", "foo")
-
- def test_dictToHeader1(self):
- self.od.add("one", "uno")
- self.od.add("two", "due")
- self.od.add("two", "tre")
- expected = [
- "one: uno\r\n",
- "two: due\r\n",
- "two: tre\r\n",
- "\r\n"
- ]
- out = repr(self.od)
- for i in expected:
- assert out.find(i) >= 0
-
- def test_dictToHeader2(self):
- self.od["one"] = ["uno"]
- expected1 = "one: uno\r\n"
- expected2 = "\r\n"
- out = repr(self.od)
- assert out.find(expected1) >= 0
- assert out.find(expected2) >= 0
-
- def test_match_re(self):
- h = flow.ODict()
- h.add("one", "uno")
- h.add("two", "due")
- h.add("two", "tre")
- assert h.match_re("uno")
- 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 = flow.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")
- assert self.od.in_any("one", "three")
- assert not self.od.in_any("one", "four")
- assert not self.od.in_any("nonexistent", "foo")
- assert not self.od.in_any("one", "TWO")
- assert self.od.in_any("one", "TWO", True)
-
- def test_copy(self):
- self.od.add("foo", 1)
- self.od.add("foo", 2)
- self.od.add("bar", 3)
- assert self.od == self.od.copy()
-
- def test_del(self):
- self.od.add("foo", 1)
- self.od.add("Foo", 2)
- self.od.add("bar", 3)
- del self.od["foo"]
- assert len(self.od.lst) == 2
-
- def test_replace(self):
- self.od.add("one", "two")
- self.od.add("two", "one")
- assert self.od.replace("one", "vun") == 2
- assert self.od.lst == [
- ["vun", "two"],
- ["two", "vun"],
- ]
-
- def test_get(self):
- self.od.add("one", "two")
- assert self.od.get("one") == ["two"]
- assert self.od.get("two") == None
-
-
-class TestODictCaseless:
- def setUp(self):
- self.od = flow.ODictCaseless()
-
- def test_override(self):
- o = flow.ODictCaseless()
- o.add('T', 'application/x-www-form-urlencoded; charset=UTF-8')
- o["T"] = ["foo"]
- assert o["T"] == ["foo"]
-
- def test_case_preservation(self):
- self.od["Foo"] = ["1"]
- assert "foo" in self.od
- assert self.od.items()[0][0] == "Foo"
- assert self.od.get("foo") == ["1"]
- assert self.od.get("foo", [""]) == ["1"]
- assert self.od.get("Foo", [""]) == ["1"]
- assert self.od.get("xx", "yy") == "yy"
-
- def test_del(self):
- self.od.add("foo", 1)
- self.od.add("Foo", 2)
- self.od.add("bar", 3)
- del self.od["foo"]
- assert len(self.od) == 1
-
-
def test_decoded():
r = tutils.treq()
assert r.content == "content"