commit 8d4bb32e075b806e7e99faa07e41f79701f47d93 Author: Isis Lovecruft isis@torproject.org Date: Tue Jun 9 00:19:49 2015 +0000
Declare that b.test.util.DummyBridge and decendents implement IBridge.
This allows for more accurate (but still mocked) testing of anything that has conditional treatment of implementers/providers of IBridge.
* CHANGE bridgedb.test.util.DummyBridge and DummyMaliciousBridge to declare that they both implement the IBridge interface.
Conflicts: lib/bridgedb/test/util.py --- lib/bridgedb/test/util.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/lib/bridgedb/test/util.py b/lib/bridgedb/test/util.py index 500bbb8..0f1e0f9 100644 --- a/lib/bridgedb/test/util.py +++ b/lib/bridgedb/test/util.py @@ -25,8 +25,11 @@ from functools import wraps from twisted.trial import unittest
from bridgedb import util as bdbutil +from bridgedb.bridges import IBridge from bridgedb.parse.addr import isIPAddress
+from zope.interface import implementer +
def fileCheckDecorator(func): """Method decorator for a t.t.unittest.TestCase test_* method. @@ -248,6 +251,7 @@ class Benchmarker(object): print("Benchmark: %12fms %12fs" % (self.milliseconds, self.seconds))
+@implementer(IBridge) class DummyBridge(object): """A mock :class:`bridgedb.bridges.Bridge` which only supports a mocked ``getBridgeLine`` method.""" @@ -284,6 +288,7 @@ class DummyBridge(object): return " ".join([item for item in line])
+@implementer(IBridge) class DummyMaliciousBridge(DummyBridge): """A mock :class:`bridgedb.Bridges.Bridge` which only supports a mocked ``getConfigLine`` method and which maliciously insert an additional fake
tor-commits@lists.torproject.org