Exemple #1
0
    def test_start_tor(self):
        """
        Test a new tor instance, assuming tor was already running.
        """
        self.assertIsNone(tor.start_tor())
        # TODO: do something in order to kill the process and restart it?

        # brutally reset start_tor.has_run
        tor.start_tor.has_run = False
        self.assertFalse(tor.start_tor())
        # once started, tor_start should return none everytime.
        self.assertIsNone(tor.start_tor())
        self.assertIsNone(tor.start_tor())
Exemple #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()