commit 1209ffee6b76b3f849fb326ae6fc41f23665a2f8 Author: Isis Lovecruft isis@torproject.org Date: Sat Feb 14 00:52:08 2015 +0000
Add unittest for Bridge._checkServerDescriptor with mismatched digest. --- lib/bridgedb/test/test_bridges.py | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/lib/bridgedb/test/test_bridges.py b/lib/bridgedb/test/test_bridges.py index ae9aa92..1d6f678 100644 --- a/lib/bridgedb/test/test_bridges.py +++ b/lib/bridgedb/test/test_bridges.py @@ -1037,6 +1037,18 @@ class BridgeTests(unittest.TestCase): self.bridge.updateFromServerDescriptor, self.serverdescriptor)
+ def test_Bridge_checkServerDescriptor_digest_mismatch(self): + """Parsing a server descriptor when the corresponding networkstatus + descriptor didn't include a server bridge.descriptorDigest should raise + a MissingServerDescriptorDigest exception. + """ + self.bridge.updateFromNetworkStatus(self.networkstatus) + + self.bridge.descriptorDigest = None + self.assertRaises(bridges.MissingServerDescriptorDigest, + self.bridge._checkServerDescriptor, + self.serverdescriptor) + def test_Bridge_assertOK(self): """If all orAddresses are okay, then assertOK() should return None.""" self.bridge.updateFromNetworkStatus(self.networkstatus)
tor-commits@lists.torproject.org