示例#1
0
 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)
示例#2
0
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()
示例#3
0
 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
示例#4
0
 def test_debugging_cli_stderr(self):
     handler = Debugging.from_cli(self.parser, 'stderr')
     self.assertIsNone(self.parser.message)
     self.assertEqual(handler.stream, sys.stderr)
示例#5
0
 def test_debugging_cli_no_args(self):
     handler = Debugging.from_cli(self.parser)
     self.assertIsNone(self.parser.message)
     self.assertEqual(handler.stream, sys.stdout)
示例#6
0
 def test_debugging_cli_stderr(self):
     handler = Debugging.from_cli(self.parser, 'stderr')
     self.assertIsNone(self.parser.message)
     self.assertEqual(handler.stream, sys.stderr)
示例#7
0
 def test_debugging_cli_no_args(self):
     handler = Debugging.from_cli(self.parser)
     self.assertIsNone(self.parser.message)
     self.assertEqual(handler.stream, sys.stdout)
示例#8
0
 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()