def test_happy_flow(self): yield self.setup_conv() yield self.start_session() yield self.assert_response('cthulhu', tw.CTHULHU_RESULTS) yield self.assert_response('1', tw.CTHULHU_SECTIONS) yield self.assert_response('2', tw.CTHULHU_USSD) [sms_msg] = self.get_outbound_msgs('sms_content') self.assertEqual(tw.CTHULHU_SMS, sms_msg['content']) self.assertEqual('+41791234567', sms_msg['to_addr']) metric_names = [name for name, _ in self.app_helper.get_published_metrics(self.app)] prefix = get_conversation_metric_prefix(self.conv) self.assertEqual(metric_names, ["%s%s" % (prefix, name)for name in [ 'wikipedia_search_call', 'wikipedia_extract_call', 'wikipedia_extract_call']])
def get_conversation_metric_manager(self, conv): # TODO: Move this to an API. prefix = get_conversation_metric_prefix(conv) return self.vumi_api.get_metric_manager(prefix)
def handle_conversation_metric(self, target): prefix = get_conversation_metric_prefix(self.conv) return get_metric_diamondash_target( prefix, target['name'], self.aggregator_from_target(target))