Skip to content

Commit

Permalink
Only run test_https.py tests if a BridgeDB process is already running.
Browse files Browse the repository at this point in the history
  • Loading branch information
isislovecruft committed Aug 27, 2014
1 parent f5360f5 commit 1bfb9c5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/bridgedb/test/test_https.py
Expand Up @@ -26,13 +26,22 @@
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'


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):
Expand Down Expand Up @@ -132,6 +141,9 @@ def getBridgeLinesFromSoup(self, soup, fieldsPerBridge):
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()

Expand All @@ -144,6 +156,9 @@ def test_get_obfs2_ipv4(self):
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()

Expand All @@ -156,6 +171,9 @@ def test_get_obfs3_ipv4(self):
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()

Expand All @@ -168,6 +186,9 @@ def test_get_vanilla_ipv4(self):
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()

Expand Down

0 comments on commit 1bfb9c5

Please sign in to comment.