示例#1
0
文件: app.py 项目: asseym/rapidsms
 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)
示例#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)
示例#3
0
文件: app.py 项目: asseym/rapidsms
 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')
示例#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')