コード例 #1
0
 def test_register_exporter(self):
     exporter = mock.Mock()
     execution_context.clear()
     execution_context.set_measure_to_view_map(MeasureToViewMap())
     view_manager = view_manager_module.ViewManager()
     view_manager.register_exporter(exporter)
     count_registered_exporters = len(
         view_manager.measure_to_view_map.exporters)
     self.assertEqual(1, count_registered_exporters)
コード例 #2
0
    def test_get_all_exported_views(self):
        execution_context.clear()
        execution_context.set_measure_to_view_map(MeasureToViewMap())
        view_manager = view_manager_module.ViewManager()
        exported_views = view_manager.get_all_exported_views()
        self.assertIsNotNone(exported_views)

        view_manager_mock = mock.Mock()
        view_manager = view_manager_mock

        view_manager.get_all_exported_views()
        self.assertTrue(view_manager_mock.get_all_exported_views.called)
コード例 #3
0
    def test_get_view(self):
        view_name = mock.Mock()
        execution_context.clear()
        execution_context.set_measure_to_view_map(MeasureToViewMap())
        view_manager = view_manager_module.ViewManager()
        view_manager.get_view(view_name=view_name)

        view_manager_mock = mock.Mock()
        view_manager = view_manager_mock

        view_manager.get_view(view_name=mock.Mock())
        self.assertTrue(view_manager_mock.get_view.called)
コード例 #4
0
    def __init__(self):
        self.time = datetime.utcnow().isoformat() + 'Z'
        if execution_context.get_measure_to_view_map() == {}:
            execution_context.set_measure_to_view_map(MeasureToViewMap())

        self._measure_view_map = execution_context.get_measure_to_view_map()
コード例 #5
0
    def __init__(self):
        self.time = utils.to_iso_str()
        if execution_context.get_measure_to_view_map() == {}:
            execution_context.set_measure_to_view_map(MeasureToViewMap())

        self._measure_view_map = execution_context.get_measure_to_view_map()
コード例 #6
0
    def __init__(self):
        if execution_context.get_measure_to_view_map() == {}:
            execution_context.set_measure_to_view_map(MeasureToViewMap())

        self.measure_to_view_map = execution_context.get_measure_to_view_map()
コード例 #7
0
 def __init__(self):
     self.time = datetime.utcnow().isoformat() + 'Z'
     self._measure_view_map = MeasureToViewMap()