def setUp(self): self.stream = StringIO() handler = Debugging(self.stream) controller = Controller(handler) controller.start() self.addCleanup(controller.stop) self.address = (controller.hostname, controller.port)
def debugging_controller(get_controller) -> Generator[Controller, None, None]: # Cannot use plain_controller fixture because we need to first create the # Debugging handler before creating the controller. stream = StringIO() handler = Debugging(stream) controller = get_controller(handler) controller.start() Global.set_addr_from(controller) # yield controller # controller.stop() stream.close()
def __enter__(self) -> 'DummyMailServer': # skipcq: PYL-W0201 self._controller = Controller( handler=Debugging(), tls_context=self._tsl_context, # otherwise mail-client have to decode data manually (split by \r\n) decode_data=True, # require starttls from client for authentication require_starttls=True, port=self._port, authenticator=self.authenticator) self._controller.start() return self
def test_debugging_cli_stderr(self): handler = Debugging.from_cli(self.parser, 'stderr') self.assertIsNone(self.parser.message) self.assertEqual(handler.stream, sys.stderr)
def test_debugging_cli_no_args(self): handler = Debugging.from_cli(self.parser) self.assertIsNone(self.parser.message) self.assertEqual(handler.stream, sys.stdout)
def setUp(self): self.data = StringIO() self.controller = Controller(Debugging(self.data), hostname=self.config['local_host'], port=self.config['local_port']) self.controller.start()
async def amain(mainEventLoop): cont = Controller(Debugging(), hostname='0.0.0.0', port=myPort) cont.start()