Пример #1
0
 def _args(self):
     return [
         'env',
         'node',
         ZombieProxyServer.__proxy_path__(),
         '/tmp/zombie.sock'
     ]
Пример #2
0
 def test_process_spawn(self):
     with fudge.patched_context(
             subprocess, 'Popen',
         (fudge.Fake('Popen').is_callable().with_args(
             self._args,
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT).returns(FakePopen()))):
         ZombieProxyServer(socket='/tmp/zombie.sock', wait=False)
Пример #3
0
 def test_configurable_socket(self):
     args = ['env', 'node', proxy_path, '/tmp/zombie-custom.sock']
     with fudge.patched_context(
             subprocess, 'Popen',
         (fudge.Fake('Popen').is_callable().with_args(
             args,
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
             stderr=subprocess.STDOUT).returns(FakePopen()))):
         ZombieProxyServer(socket='/tmp/zombie-custom.sock', wait=False)
Пример #4
0
    def test_stdout_redirect_exception(self):

        fake = FakePopen()
        fake.stdout = None

        with fudge.patched_context(
                subprocess, 'Popen',
            (fudge.Fake('Popen').is_callable().with_args(
                self._args,
                stdin=subprocess.PIPE,
                stdout=subprocess.PIPE,
                stderr=subprocess.STDOUT).returns(fake))):
            ZombieProxyServer(socket='/tmp/zombie.sock', wait=False)
Пример #5
0
    def __init__(self, server=None):
        """
        Start a new Browser instance.

        :param server: an (optional) instance of
                       :class:`zombie.proxy.server.ZombieProxyServer`.
        """
        #
        # If a proxy server isn't specified, spawn one automatically.
        #
        if server is None:
            server = ZombieProxyServer()
        self.server = server
        self.client = ZombieProxyClient(server.socket)
Пример #6
0
 def test_configurable_socket(self):
     args = [
         'env',
         'node',
         ZombieProxyServer.__proxy_path__(),
         '/tmp/zombie-custom.sock'
     ]
     with fudge.patched_context(
         subprocess,
         'Popen',
         (fudge.Fake('Popen').
                 is_callable().
                 with_args(
                     args,
                     stdin=subprocess.PIPE,
                     stdout=subprocess.PIPE,
                     stderr=subprocess.STDOUT
                 ).
                 returns(FakePopen()))
         ):
         ZombieProxyServer(socket='/tmp/zombie-custom.sock', wait=False)
Пример #7
0
 def setUp(self):
     super(TestServerSpawn, self).setUp()
     self.server = ZombieProxyServer()
Пример #8
0
 def setUp(self):
     super(ZombieProxyClientTests, self).setUp()
     # Note, As a singleton so it will be created once, not in every test.
     self.server = ZombieProxyServer()
     self.client = ZombieProxyClient(self.server.socket)
Пример #9
0
 def setUp(self):
     super(TestServerCommunication, self).setUp()
     self.server = ZombieProxyServer()
     self.client = ZombieProxyClient(self.server.socket)