def setUp(self): super(InstrumentTest, self).setUp() interface.reset_for_unittest() self.next_time = 42.0 self.time_increment = 3.0
def test_reset_for_unittest(self): metric = metrics.CounterMetric('foo', 'desc', None) metric.increment() self.assertEquals(1, metric.get()) interface.reset_for_unittest() self.assertIsNone(metric.get())
def test_reset_for_unittest(self): metric = metrics.CounterMetric('foo') metric.increment() self.assertEquals(1, metric.get()) interface.reset_for_unittest() self.assertIsNone(metric.get())
def setUp(self): super(DjangoMiddlewareTest, self).setUp() interface.reset_for_unittest() self.m = config.DjangoMiddleware(time_fn=FakeTime()) self.request = mock.Mock() self.request.body = 'x' * 42 self.request.META = {'HTTP_USER_AGENT': 'useragent'} self.response = mock.Mock() self.response.status_code = 200 self.response.content = 'x' * 43 self.view_func = view_func
def setUp(self): interface.reset_for_unittest() interface.state.global_monitor = mock.create_autospec(monitors.Monitor) interface.state.target = mock.create_autospec(targets.Target)
def test_flush_disabled(self): interface.reset_for_unittest(disable=True) interface.state.global_monitor = mock.create_autospec(monitors.Monitor) interface.state.target = mock.create_autospec(targets.Target) interface.flush() self.assertFalse(interface.state.global_monitor.send.called)
def test_flush_disabled(self): interface.reset_for_unittest(disable=True) interface.state.global_monitor = stubs.MockMonitor() interface.state.target = stubs.MockTarget() interface.flush() self.assertFalse(interface.state.global_monitor.send.called)
def reset_for_unittest(disable=False): interface.reset_for_unittest(disable=disable)
def reset_for_unittest(disable=False): shared.reset_for_unittest() interface.reset_for_unittest(disable=disable)