Example #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))
Example #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))
Example #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)
Example #4
0
 def unregister(self):
     interface.unregister(self)
Example #5
0
 def unregister(self):
   interface.unregister(self)
Example #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)