Пример #1
0
 def setUp(self):
     self.name = 'ServiceName'
     self.port = 1234
     self.q = queue.Queue()
     self.key_dir_val = None
     self.x = torproxyservice.TorProxyServiceThread(
         self.name,
         self.port,
         self.q,
         persistent=False,
         tor_key_dir=self.key_dir_val)
Пример #2
0
 def test_run_method_calls_start_persistent_on_proxy_if_persistent_is_true(
         self):
     dir_val = 'tor_key_dir_string'
     self.x = torproxyservice.TorProxyServiceThread(self.name,
                                                    self.port,
                                                    self.q,
                                                    persistent=True,
                                                    tor_key_dir=dir_val)
     self.x.proxy.tor_key_dir = dir_val
     target = self.x.proxy = MagicMock(spec=self.x.proxy)
     self.x.run()
     target.start_persistent.assert_called_with()
     self.assertEqual(target.tor_key_dir, self.x.proxy.tor_key_dir)
Пример #3
0
 def start_message_proxy(self, persistent=False, tor_key_dir=None):
     name = constants.command_list.Tor_Proxy_Message_Server
     port = settings.port_message_server
     self.message_proxy_thread = torproxyservice.TorProxyServiceThread(name, port, self.queue, persistent=persistent, tor_key_dir=tor_key_dir)
     self.message_proxy_thread.start()