diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-03-18 12:11:48 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-03-19 10:32:22 +1300 |
commit | 4e24c95a61802fd6fb9a03fdffd0380d90c46e0c (patch) | |
tree | b9a03918f7be0f373ae291a51bb9a451f3bc5aa1 /test | |
parent | 3f50d5fdbbd4c09a9b2f511f6e776930576b9633 (diff) | |
download | mitmproxy-4e24c95a61802fd6fb9a03fdffd0380d90c46e0c.tar.gz mitmproxy-4e24c95a61802fd6fb9a03fdffd0380d90c46e0c.tar.bz2 mitmproxy-4e24c95a61802fd6fb9a03fdffd0380d90c46e0c.zip |
optmanager: cope with bound methods in .subscribe
Fixes #2122
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/test_optmanager.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 84e574f5..6f87ac06 100644 --- a/test/mitmproxy/test_optmanager.py +++ b/test/mitmproxy/test_optmanager.py @@ -151,6 +151,21 @@ def test_subscribe(): o.two = 4 assert len(o.changed.receivers) == 0 + class binder: + def __init__(self): + self.o = TO() + self.called = False + self.o.subscribe(self.bound, ["two"]) + + def bound(self, *args, **kwargs): + self.called = True + + t = binder() + t.o.one = 3 + assert not t.called + t.o.two = 3 + assert t.called + def test_rollback(): o = TO() |