Beispiel #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)
Beispiel #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()
 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
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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()