def test_collect_statsbeat_metrics_exists(self, thread_mock, stats_mock): # pylint: disable=protected-access producer = statsbeat_metrics._AzureStatsbeatMetricsProducer(_OPTIONS) statsbeat_metrics._STATSBEAT_METRICS = producer statsbeat_metrics.collect_statsbeat_metrics(None) self.assertEqual(statsbeat_metrics._STATSBEAT_METRICS, producer) thread_mock.assert_not_called() stats_mock.assert_not_called()
def test_producer_get_metrics(self): # pylint: disable=protected-access producer = statsbeat_metrics._AzureStatsbeatMetricsProducer(_OPTIONS) mock_stats = mock.Mock() producer._statsbeat = mock_stats producer.get_metrics() mock_stats.get_metrics.assert_called_once()
def test_producer_ctor(self): # pylint: disable=protected-access producer = statsbeat_metrics._AzureStatsbeatMetricsProducer(_OPTIONS) metrics = producer._statsbeat self.assertTrue( isinstance( metrics, _StatsbeatMetrics ) ) self.assertEqual(metrics._instrumentation_key, "ikey")