Esempio n. 1
0
    def setUp(self):
        super(InstrumentTest, self).setUp()

        interface.reset_for_unittest()

        self.next_time = 42.0
        self.time_increment = 3.0
Esempio n. 2
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())
Esempio n. 4
0
  def setUp(self):
    super(InstrumentTest, self).setUp()

    interface.reset_for_unittest()

    self.next_time = 42.0
    self.time_increment = 3.0
Esempio n. 5
0
    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
Esempio n. 6
0
 def setUp(self):
     interface.reset_for_unittest()
     interface.state.global_monitor = mock.create_autospec(monitors.Monitor)
     interface.state.target = mock.create_autospec(targets.Target)
Esempio n. 7
0
 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)
Esempio n. 8
0
 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)
Esempio n. 9
0
def reset_for_unittest(disable=False):
    interface.reset_for_unittest(disable=disable)
Esempio n. 10
0
def reset_for_unittest(disable=False):
    shared.reset_for_unittest()
    interface.reset_for_unittest(disable=disable)
Esempio n. 11
0
def reset_for_unittest(disable=False):
  shared.reset_for_unittest()
  interface.reset_for_unittest(disable=disable)
Esempio n. 12
0
def reset_for_unittest(disable=False):
  interface.reset_for_unittest(disable=disable)
Esempio n. 13
0
 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)