def test_failed_error_metric_publish(self, mock_publish): c = Collector(self.config_object(), []) self.assertFalse(c.can_publish_metric()) with patch.object(c, "log"): try: c.publish("metric", "baz") except DiamondException: pass self.assertEquals(len(mock_publish.mock_calls), 0)
def test_failed_error_metric_publish(self, mock_publish): c = Collector(self.config_object(), []) self.assertFalse(c.can_publish_metric()) with patch.object(c, 'log'): try: c.publish('metric', "baz") except DiamondException: pass self.assertEquals(len(mock_publish.mock_calls), 0)
def test_can_publish_metric(self): c = Collector(self.config_object(), []) self.assertFalse(c.can_publish_metric()) c._socket = "socket" self.assertTrue(c.can_publish_metric())