def _check_get_handlers(self, *args): with override_settings(**self.settings): with mock.patch('rapidsms.contrib.handlers.utils.warn') as warn: handlers = get_handlers() self.assertEqual(set(handlers), set(args)) # If RAPIDSMS_HANDLERS is not defined, a deprecation warning is issued self.assertEqual(warn.called, 'RAPIDSMS_HANDLERS' not in self.settings)
def __init__(self, router): super(App, self).__init__(router) self.handlers = get_handlers() if hasattr(settings, 'RAPIDSMS_HELP_KEYWORDS'): self.triggers = settings.RAPIDSMS_HELP_KEYWORDS else: self.triggers = ['HELP', 'AIDE'] self._gather_keywords()
def _check_get_handlers(self, *args): with override_settings(**self.settings): handlers = get_handlers() self.assertEqual(len(handlers), len(args)) for handler in args: self.assertTrue(handler in handlers)