[tor-commits] [bridgedb/master] Change test_HTTPServer.py to account for '<br />'s in bridge lines.

isis at torproject.org isis at torproject.org
Tue Feb 3 02:31:03 UTC 2015


commit d8b9815c4e612834b7bb6be35ac1476617fa31ba
Author: Isis Lovecruft <isis at torproject.org>
Date:   Thu Jan 22 21:56:58 2015 +0000

    Change test_HTTPServer.py to account for '<br />'s in bridge lines.
    
     * FIXES three failing unittests in test_HTTPServer.py:
        - test_render_GET_RTLlang
        - test_render_GET_RTLlang_obfs3
        - test_render_GET_vanilla
---
 lib/bridgedb/test/test_HTTPServer.py |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/bridgedb/test/test_HTTPServer.py b/lib/bridgedb/test/test_HTTPServer.py
index 42fbdef..fccbee8 100644
--- a/lib/bridgedb/test/test_HTTPServer.py
+++ b/lib/bridgedb/test/test_HTTPServer.py
@@ -539,7 +539,15 @@ class WebResourceBridgesTests(unittest.TestCase):
         soup = BeautifulSoup(page)
         well = soup.find('div', {'class': 'bridge-lines'})
         content = well.renderContents().strip()
-        bridges = [b.strip() for b in content.splitlines()]
+        lines = content.splitlines()
+
+        bridges = []
+        for line in lines:
+            bridgelines = line.split('<br />')
+            for bridge in bridgelines:
+                if bridge:  # It still could be an empty string at this point
+                    bridges.append(bridge)
+
         return bridges
 
     def test_render_GET_vanilla(self):





More information about the tor-commits mailing list