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

[tor-commits] [bridgedb/develop] Add unittest for descriptors with identical timestamps.



commit 87fc4fa82842d4ddefad64170b202315cd82752e
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Fri Dec 5 09:24:48 2014 +0000

    Add unittest for descriptors with identical timestamps.
---
 lib/bridgedb/test/test_parse_descriptors.py |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/bridgedb/test/test_parse_descriptors.py b/lib/bridgedb/test/test_parse_descriptors.py
index 4c10874..5ed6f2f 100644
--- a/lib/bridgedb/test/test_parse_descriptors.py
+++ b/lib/bridgedb/test/test_parse_descriptors.py
@@ -303,6 +303,16 @@ class ParseDescriptorsTests(unittest.TestCase):
         self.assertEqual(bridge.fingerprint,
                          u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')
 
+    def test_parse_descriptors_deduplicate_identical_timestamps(self):
+        """Parsing two descriptors for the same bridge with identical
+        timestamps should raise a ``b.p.descriptors.DescriptorWarning``.
+        """
+        descFileOne = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR)
+        descFileTwo = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR)
+        self.assertRaises(descriptors.DescriptorWarning,
+                          descriptors.parseBridgeExtraInfoFiles,
+                          descFileOne, descFileTwo)
+
     def test_parse_descriptors_parseBridgeExtraInfoFiles_two_files(self):
         """Test for ``b.p.descriptors.parseBridgeExtraInfoFiles`` with two
         bridge extrainfo files, and check that only the newest extrainfo



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