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

[tor-commits] [bridgedb/master] Add test to check return of parseNetworkStatusFile() has `RouterStatusEntryV2`s.



commit 41ff4999a08328d235e65b4c858c36db5b76598b
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Aug 26 02:38:15 2014 +0000

    Add test to check return of parseNetworkStatusFile() has `RouterStatusEntryV2`s.
---
 lib/bridgedb/test/test_parse_descriptors.py |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/bridgedb/test/test_parse_descriptors.py b/lib/bridgedb/test/test_parse_descriptors.py
index e38b9fe..6076de0 100644
--- a/lib/bridgedb/test/test_parse_descriptors.py
+++ b/lib/bridgedb/test/test_parse_descriptors.py
@@ -187,7 +187,20 @@ class ParseDescriptorsTests(unittest.TestCase):
         routers = descriptors.parseNetworkStatusFile(descFile)
         self.assertIsInstance(routers, dict)
 
-    def test_parse_descriptors_parseBridgeNetworkStatusFile_one_file(self):
+    def test_parse_descriptors_parseBridgeNetworkStatusFile_has_RouterStatusEntryV2(self):
+        """The items in the dict returned from
+        ``b.p.descriptors.parseNetworkStatusFile`` should be
+        ``RouterStatusEntryV2``s.
+        """
+        # Write the descriptor to a file for testing. This is necessary
+        # because the function opens the networkstatus file to read it.
+        descFile = self.writeTestDescriptorsToFile('networkstatus-bridges',
+                                                   BRIDGE_NETWORKSTATUS_0)
+        routers = descriptors.parseNetworkStatusFile(descFile)
+        fingerprint, bridge = routers.items()[0]
+        self.assertIsInstance(bridge, RouterStatusEntryV2)
+
+    def test_parse_descriptors_parseBridgeNetworkStatusFile_1(self):
         """Test ``b.p.descriptors.parseNetworkStatusFile`` with one bridge
         networkstatus descriptor.
         """
@@ -202,7 +215,7 @@ class ParseDescriptorsTests(unittest.TestCase):
         self.assertEqual(bridge.fingerprint,
                          u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')
 
-    def test_parse_descriptors_parseBridgeNetworkStatusFile_two_files(self):
+    def test_parse_descriptors_parseBridgeNetworkStatusFile_2(self):
         """Test ``b.p.descriptors.parseNetworkStatusFile`` with two bridge
         networkstatus descriptors.
         """



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