def test_enable_heartbeat_metrics_exists(self, transport_mock):
     # pylint: disable=protected-access
     producer = heartbeat_metrics.AzureHeartbeatMetricsProducer()
     heartbeat_metrics._HEARTBEAT_METRICS = producer
     heartbeat_metrics.enable_heartbeat_metrics(None, None)
     self.assertEqual(heartbeat_metrics._HEARTBEAT_METRICS, producer)
     transport_mock.assert_not_called()
    def test_producer_get_metrics(self):
        producer = heartbeat_metrics.AzureHeartbeatMetricsProducer()
        metrics = producer.get_metrics()

        self.assertEqual(len(metrics), 1)
 def test_producer_ctor(self):
     producer = heartbeat_metrics.AzureHeartbeatMetricsProducer()
     # pylint: disable=protected-access
     metric = producer._heartbeat
     self.assertTrue(
         isinstance(metric, heartbeat_metrics.heartbeat.HeartbeatMetric))