mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 10:16:27 +00:00
Cleanups: remove intercept from addons.state, unused imports
This commit is contained in:
parent
81a00f6f76
commit
944dcbaaa0
@ -180,9 +180,6 @@ class State:
|
||||
self.flows = FlowStore()
|
||||
self.view = FlowView(self.flows, None)
|
||||
|
||||
# These are compiled filter expressions:
|
||||
self.intercept = None
|
||||
|
||||
@property
|
||||
def filter_txt(self):
|
||||
return getattr(self.view.filter, "pattern", None)
|
||||
@ -231,19 +228,6 @@ class State:
|
||||
self.view._close()
|
||||
self.view = FlowView(self.flows, None)
|
||||
|
||||
def set_intercept(self, txt):
|
||||
if txt:
|
||||
flt = flowfilter.parse(txt)
|
||||
if not flt:
|
||||
return "Invalid filter expression."
|
||||
self.intercept = flt
|
||||
else:
|
||||
self.intercept = None
|
||||
|
||||
@property
|
||||
def intercept_txt(self):
|
||||
return getattr(self.intercept, "pattern", None)
|
||||
|
||||
def clear(self):
|
||||
self.flows._clear()
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
from mitmproxy.addons import anticache
|
||||
from mitmproxy import master
|
||||
from mitmproxy import options
|
||||
|
@ -1,6 +1,6 @@
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
from mitmproxy.addons import anticomp
|
||||
from mitmproxy import master
|
||||
from mitmproxy import options
|
||||
|
@ -4,7 +4,7 @@ import mock
|
||||
from mitmproxy.addons import clientplayback
|
||||
from mitmproxy import options
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
|
||||
|
||||
class TestClientPlayback:
|
||||
|
@ -1,7 +1,7 @@
|
||||
import io
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
|
||||
from mitmproxy.addons import dumper
|
||||
from mitmproxy import exceptions
|
||||
|
@ -1,6 +1,6 @@
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
|
||||
import mitmproxy.test.tutils
|
||||
from mitmproxy.addons import serverplayback
|
||||
|
@ -3,8 +3,6 @@ from mitmproxy import proxy
|
||||
from mitmproxy import master
|
||||
from mitmproxy.addons import state
|
||||
|
||||
from .. import tutils
|
||||
|
||||
|
||||
class TestState:
|
||||
def test_duplicate_flow(self):
|
||||
|
@ -1,6 +1,6 @@
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
from mitmproxy.addons import stickyauth
|
||||
from mitmproxy import master
|
||||
from mitmproxy import options
|
||||
|
@ -1,6 +1,6 @@
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
from mitmproxy import master
|
||||
from mitmproxy import options
|
||||
from mitmproxy import proxy
|
||||
|
@ -6,7 +6,7 @@ from mitmproxy.tools import console
|
||||
from mitmproxy import proxy
|
||||
from mitmproxy.tools.console import common
|
||||
|
||||
from .. import tutils, mastertest
|
||||
from .. import mastertest
|
||||
|
||||
|
||||
class TestConsoleState:
|
||||
|
@ -2,7 +2,6 @@ import contextlib
|
||||
|
||||
from mitmproxy.test import tflow
|
||||
|
||||
from . import tutils
|
||||
import mitmproxy.test.tutils
|
||||
|
||||
from mitmproxy import master
|
||||
|
@ -2,7 +2,7 @@ from mitmproxy.test import tflow
|
||||
from mitmproxy.net.http import http1
|
||||
from mitmproxy.net.tcp import TCPClient
|
||||
from mitmproxy.test.tutils import treq
|
||||
from .. import tutils, tservers
|
||||
from .. import tservers
|
||||
|
||||
|
||||
class TestHTTPFlow:
|
||||
|
@ -268,14 +268,6 @@ class TestState:
|
||||
|
||||
assert "Invalid" in c.set_view_filter("~")
|
||||
|
||||
def test_set_intercept(self):
|
||||
c = state.State()
|
||||
assert not c.set_intercept("~q")
|
||||
assert c.intercept_txt == "~q"
|
||||
assert "Invalid" in c.set_intercept("~")
|
||||
assert not c.set_intercept(None)
|
||||
assert c.intercept_txt is None
|
||||
|
||||
def _add_request(self, state):
|
||||
f = tflow.tflow()
|
||||
state.add_flow(f)
|
||||
|
Loading…
Reference in New Issue
Block a user