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

[tor-commits] [bridgedb/master] Add another unittest for parseBridgeExtraInfoFiles() return type.



commit 6700f6b7f15fd3d8fe964fd3a16f64b96d455d02
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Aug 26 03:44:57 2014 +0000

    Add another unittest for parseBridgeExtraInfoFiles() return type.
---
 lib/bridgedb/test/test_parse_descriptors.py |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/bridgedb/test/test_parse_descriptors.py b/lib/bridgedb/test/test_parse_descriptors.py
index fae6441..9cb4b91 100644
--- a/lib/bridgedb/test/test_parse_descriptors.py
+++ b/lib/bridgedb/test/test_parse_descriptors.py
@@ -237,13 +237,21 @@ class ParseDescriptorsTests(unittest.TestCase):
         routers = descriptors.parseBridgeExtraInfoFiles(descFile)
         self.assertIsInstance(routers, list)
 
+    def test_parse_descriptors_parseBridgeExtraInfoFiles_has_BridgeExtraInfoDescriptor(self):
+        """The return of ``b.p.descriptors.parseBridgeExtraInfoFiles`` should
+        contain ``BridgeExtraInfoDescriptor``s.
+        """
+        descFile = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR)
+        routers = descriptors.parseBridgeExtraInfoFiles(descFile)
+        bridge = routers.values()[0]
+        self.assertIsInstance(bridge, BridgeExtraInfoDescriptor)
+
     def test_parse_descriptors_parseBridgeExtraInfoFiles_one_file(self):
         """Test for ``b.p.descriptors.parseBridgeExtraInfoFiles`` with only one
         bridge extrainfo file."""
         descFile = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR)
         routers = descriptors.parseBridgeExtraInfoFiles(descFile)
-        bridge = routers[0]
-        self.assertIsInstance(bridge, BridgeExtraInfoDescriptor)
+        bridge = routers.values()[0]
         self.assertEqual(bridge.address, u'152.78.9.20')
         self.assertEqual(bridge.fingerprint,
                          u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')
@@ -255,8 +263,7 @@ class ParseDescriptorsTests(unittest.TestCase):
         descFileOne = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR)
         descFileTwo = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR_NEWER_DUPLICATE)
         routers = descriptors.parseBridgeExtraInfoFiles(descFileOne, descFileTwo)
-        bridge = routers[0]
-        self.assertIsInstance(bridge, BridgeExtraInfoDescriptor)
+        bridge = routers.values()[0]
         self.assertEqual(bridge.address, u'152.78.9.20')
         self.assertEqual(bridge.fingerprint,
                          u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')



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