[tor-commits] [bridgedb/develop] Change obfs3 ipv6 integration test to vanilla ipv4; add scramblesuit test.

isis at torproject.org isis at torproject.org
Wed Aug 13 00:41:26 UTC 2014


commit d798533ff482bd7c1a149d1d38bcc9dfb53da3bc
Author: trygve <tor-dev at lists.torproject.org>
Date:   Fri Aug 8 03:06:18 2014 +0000

    Change obfs3 ipv6 integration test to vanilla ipv4; add scramblesuit test.
    
    The ipv6 bridge has been changed to a vanilla ipv4 bridge. I've also added a
    new test to check for a scramblesuit bridge. Both of these surprised me
    because they had a different number of fields in each bridge line, but I've
    adjusted the tests accordingly.
---
 lib/bridgedb/test/test_https.py |   33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/lib/bridgedb/test/test_https.py b/lib/bridgedb/test/test_https.py
index a154856..4ffbe08 100644
--- a/lib/bridgedb/test/test_https.py
+++ b/lib/bridgedb/test/test_https.py
@@ -114,7 +114,7 @@ class HTTPTests(unittest.TestCase):
 	#print soup.prettify()
 	return soup
 
-    def getBridgeLinesFromSoup(self, soup):
+    def getBridgeLinesFromSoup(self, soup, fieldsPerBridge):
 	# Now we're looking for something like this in the response:
 	#     <div class="bridge-lines">
 	#      obfs2 175.213.252.207:11125 5c6da7d927460317c6ff5420b75c2d0f431f18dd
@@ -126,7 +126,7 @@ class HTTPTests(unittest.TestCase):
 	    text = bridge_line.text
 	    #print("Found bridge-line: %s" % text)
 	    items = text.split(' ')
-   	    self.assertEquals(len(items), 3, "Expected Pluggale Transport, Bridge and Fingerprint in %s" % str(items))
+   	    self.assertEquals(len(items), fieldsPerBridge, "Expected %d fields in bridge line %s" % (fieldsPerBridge, str(items)))
 	    bridges.append(items)
 	return bridges
 
@@ -137,7 +137,7 @@ class HTTPTests(unittest.TestCase):
 	PT = 'obfs2'
         soup = self.submitOptions(transport=PT, ipv6=False, captchaResponse=CAPTCHA_RESPONSE)
 
-	bridges = self.getBridgeLinesFromSoup(soup)
+	bridges = self.getBridgeLinesFromSoup(soup, fieldsPerBridge=3)
         for pt, bridge, fingerprint in bridges:
 	    self.assertEquals(PT, pt)
 
@@ -148,19 +148,32 @@ class HTTPTests(unittest.TestCase):
 	PT = 'obfs3'
         soup = self.submitOptions(transport=PT, ipv6=False, captchaResponse=CAPTCHA_RESPONSE)
 
-	bridges = self.getBridgeLinesFromSoup(soup)
+	bridges = self.getBridgeLinesFromSoup(soup, fieldsPerBridge=3)
         for pt, bridge, fingerprint in bridges:
 	    self.assertEquals(PT, pt)
 
-    def test_get_obfs3_ipv6(self):
+    def test_get_vanilla_ipv4(self):
 	self.openBrowser()
 	self.goToOptionsPage()
 
-	PT = 'obfs3'
-        soup = self.submitOptions(transport=PT, ipv6=True, captchaResponse=CAPTCHA_RESPONSE)
+	PT = '0'
+        soup = self.submitOptions(transport=PT, ipv6=False, captchaResponse=CAPTCHA_RESPONSE)
 
-	# at the time of writing, this test fails due to lack of ipv6 bridges
-	bridges = self.getBridgeLinesFromSoup(soup)
-        for pt, bridge, fingerprint in bridges:
+	bridges = self.getBridgeLinesFromSoup(soup, fieldsPerBridge=2)
+	for bridge, fingerprint in bridges:
+           # TODO: do more interesting checks
+	   self.assertTrue(bridge != None) 
+
+    def test_get_scramblesuit_ipv4(self):
+	self.openBrowser()
+	self.goToOptionsPage()
+
+	PT = 'scramblesuit'
+	soup = self.submitOptions(transport=PT, ipv6=False, captchaResponse=CAPTCHA_RESPONSE)
+
+	bridges = self.getBridgeLinesFromSoup(soup, fieldsPerBridge=4)
+	for pt, bridge, fingerprint, password in bridges:
 	    self.assertEquals(PT, pt)
+	    self.assertTrue(password.find("password=") != -1, "Password field missing expected text")
+
 





More information about the tor-commits mailing list