예제 #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')