commit 9111886f2785da3995b2e1f78737326aedbcb4a7 Author: Isis Lovecruft isis@torproject.org Date: Wed Aug 20 04:30:09 2014 +0000
Fix test_https tests to handle multiple bridge lines.
See https://travis-ci.org/isislovecruft/bridgedb/jobs/33035309#L1781 for an example of how this test was failing. --- lib/bridgedb/test/test_https.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/test/test_https.py b/lib/bridgedb/test/test_https.py index cad0715..40ab865 100644 --- a/lib/bridgedb/test/test_https.py +++ b/lib/bridgedb/test/test_https.py @@ -120,12 +120,11 @@ class HTTPTests(unittest.TestCase): # obfs2 175.213.252.207:11125 5c6da7d927460317c6ff5420b75c2d0f431f18dd # </div> bridges = [] - bridge_lines = soup.findAll(attrs={'class' : 'bridge-lines'}) + soup = soup.findAll(attrs={'class' : 'bridge-lines'}) + bridge_lines = [line.text.split('\n') for line in soup] self.assertTrue(len(bridge_lines) > 0, "Found no bridge lines") for bridge_line in bridge_lines: - text = bridge_line.text - #print("Found bridge-line: %s" % text) - items = text.split(' ') + items = bridge_line.split(' ') self.assertEquals(len(items), fieldsPerBridge, "Expected %d fields in bridge line %s" % (fieldsPerBridge, str(items))) bridges.append(items) return bridges
tor-commits@lists.torproject.org