Ejemplo n.º 1
0
 def test_register_unregister(self):
     fake_metric = mock.Mock()
     self.assertEqual(0, len(interface.state.metrics))
     interface.register(fake_metric)
     self.assertEqual(1, len(interface.state.metrics))
     interface.unregister(fake_metric)
     self.assertEqual(0, len(interface.state.metrics))
Ejemplo n.º 2
0
 def test_register_unregister(self):
   fake_metric = mock.Mock()
   self.assertEqual(0, len(interface.state.metrics))
   interface.register(fake_metric)
   self.assertEqual(1, len(interface.state.metrics))
   interface.unregister(fake_metric)
   self.assertEqual(0, len(interface.state.metrics))
Ejemplo n.º 3
0
 def test_unregister_missing_raises(self):
     fake_metric = mock.Mock(_name='foo')
     self.assertEqual(0, len(interface.state.metrics))
     with self.assertRaises(KeyError):
         interface.unregister(fake_metric)
Ejemplo n.º 4
0
 def unregister(self):
     interface.unregister(self)
Ejemplo n.º 5
0
 def unregister(self):
   interface.unregister(self)
Ejemplo n.º 6
0
 def test_unregister_missing_raises(self):
   fake_metric = mock.Mock(_name='foo')
   self.assertEqual(0, len(interface.state.metrics))
   with self.assertRaises(KeyError):
     interface.unregister(fake_metric)