Exemplo n.º 1
0
 def get_subhandler_classes():
     subhandler_classes = {}
     for conversation_type in configured_conversation_types().keys():
         conv_def = get_conversation_definition(conversation_type)
         if conv_def is None or conv_def.api_dispatcher_cls is None:
             continue
         subhandler_classes[conversation_type] = conv_def.api_dispatcher_cls
     return subhandler_classes
Exemplo n.º 2
0
 def get_subhandler_classes():
     subhandler_classes = {}
     for conversation_type in configured_conversation_types().keys():
         conv_def = get_conversation_definition(conversation_type)
         if conv_def is None or conv_def.api_dispatcher_cls is None:
             continue
         subhandler_classes[conversation_type] = (
             conv_def.api_dispatcher_cls)
     return subhandler_classes
Exemplo n.º 3
0
    def publish_conversation_metrics(self, user_api, conversation_key):
        conv = yield user_api.get_conversation(conversation_key)
        metrics = self.get_conversation_metric_manager(conv)

        conv_type = conv.conversation_type
        conv_def = get_conversation_definition(conv_type, conv)

        for metric in conv_def.get_metrics():
            value = yield metric.get_value(user_api)
            metrics.oneshot(metric.metric, value)

        metrics.publish_metrics()
Exemplo n.º 4
0
    def publish_conversation_metrics(self, user_api, conversation_key):
        conv = yield user_api.get_conversation(conversation_key)
        metrics = self.get_conversation_metric_manager(conv)

        conv_type = conv.conversation_type
        conv_def = get_conversation_definition(conv_type, conv)

        for metric in conv_def.get_metrics():
            value = yield metric.get_value(user_api)
            metrics.oneshot(metric.metric, value)

        metrics.publish_metrics()
Exemplo n.º 5
0
 def test_get_conversation_definition_with_conv(self):
     dummy_conv = object()
     conv_def = get_conversation_definition('bulk_message', dummy_conv)
     self.assertTrue(conv_def.conv is dummy_conv)
Exemplo n.º 6
0
 def test_get_conversation_definition(self):
     conv_def = get_conversation_definition('bulk_message')
     from go.apps.bulk_message.definition import ConversationDefinition
     self.assertTrue(isinstance(conv_def, ConversationDefinition))
     self.assertEqual(conv_def.conversation_type, 'bulk_message')
Exemplo n.º 7
0
 def test_get_conversation_definition_with_conv(self):
     dummy_conv = object()
     conv_def = get_conversation_definition('bulk_message', dummy_conv)
     self.assertTrue(conv_def.conv is dummy_conv)
Exemplo n.º 8
0
 def test_get_conversation_definition(self):
     conv_def = get_conversation_definition('bulk_message')
     from go.apps.bulk_message.definition import ConversationDefinition
     self.assertTrue(isinstance(conv_def, ConversationDefinition))
     self.assertEqual(conv_def.conversation_type, 'bulk_message')