def get(self, request, conversation): campaign_key = request.user_api.user_account_key log_manager = LogManager(request.user_api.api.redis) logs = log_manager.get_logs(campaign_key, conversation.key) logs = list(reversed(logs)) return self.render_to_response({ "conversation": conversation, "logs": logs, })
def test_jsbox_logs(self): conv_helper = self.setup_conversation() campaign_key = conv_helper.get_conversation().user_account.key log_manager = LogManager( self.app_helper.vumi_helper.get_vumi_api().redis) for i in range(10): log_manager.add_log(campaign_key, conv_helper.conversation_key, "test %d" % i, logging.INFO) response = self.client.get(conv_helper.get_view_url('jsbox_logs')) self.assertEqual(response.status_code, 200) for i in range(10): self.assertContains(response, "INFO] test %d" % i)
def log_manager(self, max_logs=None): return LogManager(self.parent_redis, max_logs)