[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/develop] Add another test for Bridge._checkServerDescriptor() with bad digest.



commit bbdfb3c4fc6b97364733705801329faf6737de5e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Sat Feb 14 03:13:17 2015 +0000

    Add another test for Bridge._checkServerDescriptor() with bad digest.
---
 lib/bridgedb/test/test_bridges.py |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/test/test_bridges.py b/lib/bridgedb/test/test_bridges.py
index 1d6f678..7368b8d 100644
--- a/lib/bridgedb/test/test_bridges.py
+++ b/lib/bridgedb/test/test_bridges.py
@@ -1013,7 +1013,7 @@ class BridgeTests(unittest.TestCase):
         #                  self.bridge.updateFromNetworkStatus,
         #                  networkstatus[0])
 
-    def test_Bridge_checkServerDescriptor_digest_mismatch(self):
+    def test_Bridge_checkServerDescriptor_digest_mismatch_ns(self):
         """Parsing a server descriptor whose digest doesn't match the one given
         in the bridge's networkstatus document should raise a
         ServerDescriptorDigestMismatch.
@@ -1037,7 +1037,19 @@ class BridgeTests(unittest.TestCase):
                           self.bridge.updateFromServerDescriptor,
                           self.serverdescriptor)
 
-    def test_Bridge_checkServerDescriptor_digest_mismatch(self):
+    def test_Bridge_checkServerDescriptor_digest_mismatch_sd(self):
+        """Parsing a server descriptor when the corresponding networkstatus
+        descriptor didn't include a server bridge.descriptorDigest that matches
+        should raise a ServerDescriptorDigestMismatch exception.
+        """
+        self.bridge.updateFromNetworkStatus(self.networkstatus)
+
+        self.bridge.descriptorDigest = 'deadbeef'
+        self.assertRaises(bridges.ServerDescriptorDigestMismatch,
+                          self.bridge._checkServerDescriptor,
+                          self.serverdescriptor)
+
+    def test_Bridge_checkServerDescriptor_digest_missing(self):
         """Parsing a server descriptor when the corresponding networkstatus
         descriptor didn't include a server bridge.descriptorDigest should raise
         a MissingServerDescriptorDigest exception.



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits