Ejemplo n.º 1
0
 def test_no_handlers(self):
     """If app has no (relevant) handlers, it should return nothing."""
     app = HandlersApp(self.router)
     app.handlers = []
     msg = IncomingMessage(self.connection, 'hello world')
     retVal = app.handle(msg)
     self.assertEqual(retVal, None)
     self.assertEqual(len(msg.responses), 0)
Ejemplo n.º 2
0
 def test_no_handlers(self):
     """If app has no (relevant) handlers, it should return nothing."""
     app = HandlersApp(self.router)
     app.handlers = []
     msg = IncomingMessage(self.connection, 'hello world')
     retVal = app.handle(msg)
     self.assertEqual(retVal, None)
     self.assertEqual(len(msg.responses), 0)
Ejemplo n.º 3
0
 def test_handle(self):
     """App should call upon its handlers to respond to the message."""
     app = HandlersApp(self.router)
     app.handlers = [EchoKeywordHandler]
     msg = IncomingMessage(self.connection, 'hello world')
     retVal = app.handle(msg)
     self.assertTrue(retVal)
     self.assertEqual(len(msg.responses), 1)
     self.assertEqual(msg.responses[0].text, 'world')
Ejemplo n.º 4
0
 def test_handle(self):
     """App should call upon its handlers to respond to the message."""
     app = HandlersApp(self.router)
     app.handlers = [EchoKeywordHandler]
     msg = IncomingMessage(self.connection, 'hello world')
     retVal = app.handle(msg)
     self.assertTrue(retVal)
     self.assertEqual(len(msg.responses), 1)
     self.assertEqual(msg.responses[0]['text'], 'world')