diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_flow.py | 9 | ||||
-rw-r--r-- | test/test_server.py | 10 |
2 files changed, 14 insertions, 5 deletions
diff --git a/test/test_flow.py b/test/test_flow.py index 914138c9..a297bf5f 100644 --- a/test/test_flow.py +++ b/test/test_flow.py @@ -1,6 +1,7 @@ import Queue, time, os.path from cStringIO import StringIO import email.utils +import mock from libmproxy import filt, protocol, controller, utils, tnetstring, flow from libmproxy.protocol.primitives import Error, Flow from libmproxy.protocol.http import decoded, CONTENT_MISSING @@ -541,6 +542,14 @@ class TestFlowMaster: assert "ValueError" in fm.load_script(tutils.test_data.path("scripts/starterr.py")) assert len(fm.scripts) == 0 + def test_getset_ignore(self): + p = mock.Mock() + p.config.ignore = [] + fm = flow.FlowMaster(p, flow.State()) + assert not fm.get_ignore() + fm.set_ignore(["^apple\.com:", ":443$"]) + assert fm.get_ignore() + def test_replay(self): s = flow.State() fm = flow.FlowMaster(None, s) diff --git a/test/test_server.py b/test/test_server.py index b128d0a2..0ce5d056 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -1,5 +1,5 @@ import socket, time -from libmproxy.proxy.config import ProxyConfig +from libmproxy.proxy.config import parse_host_pattern from netlib import tcp, http_auth, http from libpathod import pathoc, pathod from netlib.certutils import SSLCert @@ -79,8 +79,8 @@ class CommonMixin: class TcpMixin: def _ignore_on(self): - conf = ProxyConfig(ignore=[".+:%s" % self.server.port]) - self.config.ignore.append(conf.ignore[0]) + ignore = parse_host_pattern([".+:%s" % self.server.port])[0] + self.config.ignore.append(ignore) def _ignore_off(self): self.config.ignore.pop() @@ -581,9 +581,9 @@ class TestUpstreamProxySSL(tservers.HTTPUpstreamProxTest, CommonMixin, TcpMixin) def _ignore_on(self): super(TestUpstreamProxySSL, self)._ignore_on() - conf = ProxyConfig(ignore=[".+:%s" % self.server.port]) + ignore = parse_host_pattern([".+:%s" % self.server.port])[0] for proxy in self.chain: - proxy.tmaster.server.config.ignore.append(conf.ignore[0]) + proxy.tmaster.server.config.ignore.append(ignore) def _ignore_off(self): super(TestUpstreamProxySSL, self)._ignore_off() |