aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_examples.py3
-rw-r--r--test/mitmproxy/tutils.py3
-rw-r--r--test/netlib/http/test_request.py2
-rw-r--r--test/netlib/test_multidict.py26
-rw-r--r--test/netlib/test_odict.py10
-rw-r--r--test/pathod/test_pathoc.py2
-rw-r--r--test/pathod/test_pathod.py7
-rw-r--r--test/pathod/tutils.py2
8 files changed, 34 insertions, 21 deletions
diff --git a/test/mitmproxy/test_examples.py b/test/mitmproxy/test_examples.py
index ac79b093..c4b06f4b 100644
--- a/test/mitmproxy/test_examples.py
+++ b/test/mitmproxy/test_examples.py
@@ -5,11 +5,12 @@ from contextlib import contextmanager
from mitmproxy import utils, script
from mitmproxy.proxy import config
+import netlib.utils
from netlib import tutils as netutils
from netlib.http import Headers
from . import tservers, tutils
-example_dir = utils.Data(__name__).path("../../examples")
+example_dir = netlib.utils.Data(__name__).path("../../examples")
class DummyContext(object):
diff --git a/test/mitmproxy/tutils.py b/test/mitmproxy/tutils.py
index d51ac185..2dfd710e 100644
--- a/test/mitmproxy/tutils.py
+++ b/test/mitmproxy/tutils.py
@@ -8,6 +8,7 @@ from contextlib import contextmanager
from unittest.case import SkipTest
+import netlib.utils
import netlib.tutils
from mitmproxy import utils, controller
from mitmproxy.models import (
@@ -163,4 +164,4 @@ def capture_stderr(command, *args, **kwargs):
sys.stderr = out
-test_data = utils.Data(__name__)
+test_data = netlib.utils.Data(__name__)
diff --git a/test/netlib/http/test_request.py b/test/netlib/http/test_request.py
index eefdc091..fae7aefe 100644
--- a/test/netlib/http/test_request.py
+++ b/test/netlib/http/test_request.py
@@ -3,9 +3,7 @@ from __future__ import absolute_import, print_function, division
import six
-from netlib import utils
from netlib.http import Headers
-from netlib.odict import ODict
from netlib.tutils import treq, raises
from .test_message import _test_decoded_attr, _test_passthrough_attr
diff --git a/test/netlib/test_multidict.py b/test/netlib/test_multidict.py
index ceea3806..5bb65e3f 100644
--- a/test/netlib/test_multidict.py
+++ b/test/netlib/test_multidict.py
@@ -1,5 +1,5 @@
from netlib import tutils
-from netlib.multidict import MultiDict, ImmutableMultiDict
+from netlib.multidict import MultiDict, ImmutableMultiDict, MultiDictView
class _TMulti(object):
@@ -214,4 +214,26 @@ class TestImmutableMultiDict(object):
def test_with_insert(self):
md = TImmutableMultiDict()
assert md.with_insert(0, "foo", "bar").fields == (("foo", "bar"),)
- assert md.fields == () \ No newline at end of file
+
+
+class TParent(object):
+ def __init__(self):
+ self.vals = tuple()
+
+ def setter(self, vals):
+ self.vals = vals
+
+ def getter(self):
+ return self.vals
+
+
+class TestMultiDictView(object):
+ def test_modify(self):
+ p = TParent()
+ tv = MultiDictView(p.getter, p.setter)
+ assert len(tv) == 0
+ tv["a"] = "b"
+ assert p.vals == (("a", "b"),)
+ tv["c"] = "b"
+ assert p.vals == (("a", "b"), ("c", "b"))
+ assert tv["a"] == "b"
diff --git a/test/netlib/test_odict.py b/test/netlib/test_odict.py
index f0985ef6..b6fd6401 100644
--- a/test/netlib/test_odict.py
+++ b/test/netlib/test_odict.py
@@ -27,16 +27,6 @@ class TestODict(object):
b.set_state(state)
assert b == od
- def test_in_any(self):
- od = odict.ODict()
- od["one"] = ["atwoa", "athreea"]
- assert od.in_any("one", "two")
- assert od.in_any("one", "three")
- assert not od.in_any("one", "four")
- assert not od.in_any("nonexistent", "foo")
- assert not od.in_any("one", "TWO")
- assert od.in_any("one", "TWO", True)
-
def test_iter(self):
od = odict.ODict()
assert not [i for i in od]
diff --git a/test/pathod/test_pathoc.py b/test/pathod/test_pathoc.py
index 8d0f92ac..4e8c89c5 100644
--- a/test/pathod/test_pathoc.py
+++ b/test/pathod/test_pathoc.py
@@ -211,7 +211,7 @@ class TestDaemon(_TestDaemon):
c.stop()
@skip_windows
- @pytest.mark.xfail
+ @pytest.mark.skip(reason="race condition")
def test_wait_finish(self):
c = pathoc.Pathoc(
("127.0.0.1", self.d.port),
diff --git a/test/pathod/test_pathod.py b/test/pathod/test_pathod.py
index 1718cc0b..05a3962e 100644
--- a/test/pathod/test_pathod.py
+++ b/test/pathod/test_pathod.py
@@ -129,7 +129,7 @@ class CommonTests(tutils.DaemonTests):
l = self.d.last_log()
# FIXME: Other binary data elements
- @pytest.mark.skip
+ @pytest.mark.skip(reason="race condition")
def test_sizelimit(self):
r = self.get("200:b@1g")
assert r.status_code == 800
@@ -143,7 +143,7 @@ class CommonTests(tutils.DaemonTests):
def test_info(self):
assert tuple(self.d.info()["version"]) == version.IVERSION
- @pytest.mark.skip
+ @pytest.mark.skip(reason="race condition")
def test_logs(self):
assert self.d.clear_log()
assert not self.d.last_log()
@@ -223,7 +223,7 @@ class CommonTests(tutils.DaemonTests):
)
assert r[1].payload == "test"
- @pytest.mark.skip
+ @pytest.mark.skip(reason="race condition")
def test_websocket_frame_reflect_error(self):
r, _ = self.pathoc(
["ws:/p/", "wf:-mask:knone:f'wf:b@10':i13,'a'"],
@@ -233,6 +233,7 @@ class CommonTests(tutils.DaemonTests):
# FIXME: Race Condition?
assert "Parse error" in self.d.text_log()
+ @pytest.mark.skip(reason="race condition")
def test_websocket_frame_disconnect_error(self):
self.pathoc(["ws:/p/", "wf:b@10:d3"], ws_read_limit=0)
assert self.d.last_log()
diff --git a/test/pathod/tutils.py b/test/pathod/tutils.py
index 9739afde..f6ed3efb 100644
--- a/test/pathod/tutils.py
+++ b/test/pathod/tutils.py
@@ -116,7 +116,7 @@ tmpdir = netlib.tutils.tmpdir
raises = netlib.tutils.raises
-test_data = utils.Data(__name__)
+test_data = netlib.utils.Data(__name__)
def render(r, settings=language.Settings()):