Esempio n. 1
0
    def test_torsocks(self):
        """
        Once a new torctl is created -hence tor is running,
        perform various tests on the proxy.
        """
        self.assertIsNone(tor.torsocks())

        try:
            urllib.urlopen("http://globaleaks.org")
        except IOError, e:
            self.fail("Unable to connect: <%s>" % str(e))
Esempio n. 2
0
import unittest

import tornado.httpserver
import tornado.httpclient
import tornado.ioloop

from awaf import app
from awaf import config
from awaf.anonymity import tor

# start tor
tor.start_tor()
tor.torsocks()

# start tornado server
server = tornado.httpserver.HTTPServer(app.exapp)
server.listen(config.hidport)

class TestawafApp(unittest.TestCase):
    """
    Test the web application for GlobaLeaks.
    """

    def timed(func):
        """
        Testing on time delays is also important.
        This function provides a decorator for tests which
        needs a lag as short as possible.
        """
        def inner(*args, **kwargs):
            time0 = time.time()