コード例 #1
0
ファイル: test_anonymity_tor.py プロジェクト: pyhead/awaf
    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))
コード例 #2
0
ファイル: test_app.py プロジェクト: pyhead/awaf
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()