diff options
-rw-r--r-- | mitmproxy/addons/view.py | 2 | ||||
-rw-r--r-- | test/mitmproxy/addons/test_view.py | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/mitmproxy/addons/view.py b/mitmproxy/addons/view.py index aa3e11ed..d4319468 100644 --- a/mitmproxy/addons/view.py +++ b/mitmproxy/addons/view.py @@ -389,6 +389,8 @@ class View(collections.Sequence): self.sig_view_remove.send(self, flow=f) del self._store[f.id] self.sig_store_remove.send(self, flow=f) + if len(flows) > 1: + ctx.log.alert("Removed %s flows" % len(flows)) @command.command("view.resolve") def resolve(self, spec: str) -> typing.Sequence[mitmproxy.flow.Flow]: diff --git a/test/mitmproxy/addons/test_view.py b/test/mitmproxy/addons/test_view.py index d5a3a456..03b2c8dd 100644 --- a/test/mitmproxy/addons/test_view.py +++ b/test/mitmproxy/addons/test_view.py @@ -262,6 +262,16 @@ def test_duplicate(): assert v.focus.index == 2 +def test_remove(): + v = view.View() + with taddons.context(): + f = [tflow.tflow(), tflow.tflow() ] + v.add(f) + assert len(v) == 2 + v.remove(f) + assert len(v) == 0 + + def test_setgetval(): v = view.View() with taddons.context(): |