commit 75ab626e39474eba43a045a6110acf513bfe9410 Author: Isis Lovecruft isis@torproject.org Date: Tue Aug 26 02:01:18 2014 +0000
Add unittest explicitly for return type of parseBridgeExtraInfoFiles(). --- lib/bridgedb/test/test_parse_descriptors.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/bridgedb/test/test_parse_descriptors.py b/lib/bridgedb/test/test_parse_descriptors.py index 0ad54aa..e38b9fe 100644 --- a/lib/bridgedb/test/test_parse_descriptors.py +++ b/lib/bridgedb/test/test_parse_descriptors.py @@ -218,12 +218,19 @@ class ParseDescriptorsTests(unittest.TestCase): self.assertEqual(bridge.fingerprint, u'6FA9216CF3A06E89A03121ACC31F70F8DFD7DDCC')
+ def test_parse_descriptors_parseBridgeExtraInfoFiles_return_type(self): + """The return type of ``b.p.descriptors.parseBridgeExtraInfoFiles`` + should be a list. + """ + descFile = io.BytesIO(BRIDGE_EXTRA_INFO_DESCRIPTOR) + routers = descriptors.parseBridgeExtraInfoFiles(descFile) + self.assertIsInstance(routers, list) + 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) - self.assertIsInstance(routers, list) bridge = routers[0] self.assertIsInstance(bridge, BridgeExtraInfoDescriptor) self.assertEqual(bridge.address, u'152.78.9.20') @@ -237,7 +244,6 @@ 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) - self.assertIsInstance(routers, list) bridge = routers[0] self.assertIsInstance(bridge, BridgeExtraInfoDescriptor) self.assertEqual(bridge.address, u'152.78.9.20')