commit 1bfb9c5fce4b47bc7990a2565cbb153c991cfeb1 Author: Isis Lovecruft isis@torproject.org Date: Wed Aug 27 05:42:56 2014 +0000
Only run test_https.py tests if a BridgeDB process is already running. --- lib/bridgedb/test/test_https.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/lib/bridgedb/test/test_https.py b/lib/bridgedb/test/test_https.py index 7b1c8c8..176b769 100644 --- a/lib/bridgedb/test/test_https.py +++ b/lib/bridgedb/test/test_https.py @@ -26,6 +26,10 @@ from __future__ import print_function from twisted.trial import unittest from BeautifulSoup import BeautifulSoup import mechanize +import os + +from bridgedb.test.util import processExists +from bridgedb.test.util import getBridgeDBPID
HTTPS_ROOT = 'https://127.0.0.1:6789' CAPTCHA_RESPONSE = 'Tvx74Pmy' @@ -33,6 +37,11 @@ CAPTCHA_RESPONSE = 'Tvx74Pmy'
class HTTPTests(unittest.TestCase): def setUp(self): + here = os.getcwd() + topdir = here.rstrip('_trial_temp') + self.rundir = os.path.join(topdir, 'run') + self.pidfile = os.path.join(self.rundir, 'bridgedb.pid') + self.pid = getBridgeDBPID(self.pidfile) self.br = None
def tearDown(self): @@ -132,6 +141,9 @@ class HTTPTests(unittest.TestCase): return bridges
def test_get_obfs2_ipv4(self): + if not self.pid or not processExists(self.pid): + raise SkipTest("Can't run test: no BridgeDB process running.") + self.openBrowser() self.goToOptionsPage()
@@ -144,6 +156,9 @@ class HTTPTests(unittest.TestCase): self.assertEquals(PT, pt)
def test_get_obfs3_ipv4(self): + if not self.pid or not processExists(self.pid): + raise SkipTest("Can't run test: no BridgeDB process running.") + self.openBrowser() self.goToOptionsPage()
@@ -156,6 +171,9 @@ class HTTPTests(unittest.TestCase): self.assertEquals(PT, pt)
def test_get_vanilla_ipv4(self): + if not self.pid or not processExists(self.pid): + raise SkipTest("Can't run test: no BridgeDB process running.") + self.openBrowser() self.goToOptionsPage()
@@ -168,6 +186,9 @@ class HTTPTests(unittest.TestCase): self.assertTrue(bridge != None)
def test_get_scramblesuit_ipv4(self): + if not self.pid or not processExists(self.pid): + raise SkipTest("Can't run test: no BridgeDB process running.") + self.openBrowser() self.goToOptionsPage()