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

[tor-commits] [bridgedb/master] Fix unittests for return values of parseNetworkstatusFile().



commit c2f79261dfcc9e1f08006177e5881ca189cf6270
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Fri Aug 29 07:36:41 2014 +0000

    Fix unittests for return values of parseNetworkstatusFile().
    
    `bridgedb.parse.descriptors.parseNetworkstatusFile()` now returns list
    of `stem.descriptors.router_status_entry.RouterStatusEntryV3s`.
---
 lib/bridgedb/test/test_parse_descriptors.py |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/bridgedb/test/test_parse_descriptors.py b/lib/bridgedb/test/test_parse_descriptors.py
index b947a39..1abd08f 100644
--- a/lib/bridgedb/test/test_parse_descriptors.py
+++ b/lib/bridgedb/test/test_parse_descriptors.py
@@ -22,7 +22,7 @@ HAS_STEM = False
 try:
     from stem.descriptor.server_descriptor import RelayDescriptor
     from stem.descriptor.extrainfo_descriptor import BridgeExtraInfoDescriptor
-    from stem.descriptor.router_status_entry import RouterStatusEntryV2
+    from stem.descriptor.router_status_entry import RouterStatusEntryV3
     from bridgedb.parse import descriptors
 except (ImportError, NameError), error:
     print("There was an error importing stem: %s" % error)
@@ -185,7 +185,7 @@ class ParseDescriptorsTests(unittest.TestCase):
         descFile = self.writeTestDescriptorsToFile('networkstatus-bridges',
                                                    BRIDGE_NETWORKSTATUS_0)
         routers = descriptors.parseNetworkStatusFile(descFile)
-        self.assertIsInstance(routers, dict)
+        self.assertIsInstance(routers, list)
 
     def test_parse_descriptors_parseBridgeNetworkStatusFile_has_RouterStatusEntryV2(self):
         """The items in the dict returned from
@@ -197,8 +197,8 @@ class ParseDescriptorsTests(unittest.TestCase):
         descFile = self.writeTestDescriptorsToFile('networkstatus-bridges',
                                                    BRIDGE_NETWORKSTATUS_0)
         routers = descriptors.parseNetworkStatusFile(descFile)
-        fingerprint, bridge = routers.items()[0]
-        self.assertIsInstance(bridge, RouterStatusEntryV2)
+        bridge = routers[0]
+        self.assertIsInstance(bridge, RouterStatusEntryV3)
 
     def test_parse_descriptors_parseBridgeNetworkStatusFile_1(self):
         """Test ``b.p.descriptors.parseNetworkStatusFile`` with one bridge
@@ -209,9 +209,9 @@ class ParseDescriptorsTests(unittest.TestCase):
         descFile = self.writeTestDescriptorsToFile('networkstatus-bridges',
                                                    BRIDGE_NETWORKSTATUS_0)
         routers = descriptors.parseNetworkStatusFile(descFile)
-        fingerprint, bridge = routers.items()[0]
+        bridge = routers[0]
         self.assertEqual(bridge.address, u'152.78.9.20')
-        self.assertEqual(fingerprint,
+        self.assertEqual(bridge.fingerprint,
                          u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')
 
     def test_parse_descriptors_parseBridgeNetworkStatusFile_2(self):
@@ -224,9 +224,9 @@ class ParseDescriptorsTests(unittest.TestCase):
                                                    BRIDGE_NETWORKSTATUS_0,
                                                    BRIDGE_NETWORKSTATUS_1)
         routers = descriptors.parseNetworkStatusFile(descFile)
-        fingerprint, bridge = routers.items()[0]
+        bridge = routers[0]
         self.assertEqual(bridge.address, u'152.78.9.20')
-        self.assertEqual(fingerprint,
+        self.assertEqual(bridge.fingerprint,
                          u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')
 
     def test_parse_descriptors_parseBridgeExtraInfoFiles_return_type(self):



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