def _args(self): return [ 'env', 'node', ZombieProxyServer.__proxy_path__(), '/tmp/zombie.sock' ]
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)
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)
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)
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)
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)
def setUp(self): super(TestServerSpawn, self).setUp() self.server = ZombieProxyServer()
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)
def setUp(self): super(TestServerCommunication, self).setUp() self.server = ZombieProxyServer() self.client = ZombieProxyClient(self.server.socket)