def test_register_spec_handler(self):
    self.patch_object(conncheck.ConnCheckManager, '_spec_handlers', name='mock_cls__spec_handlers', new={})

    def handler():
        pass
    conncheck.ConnCheckManager.register_spec_handler('juju', handler)
    self.assertIn('juju', conncheck.ConnCheckManager._spec_handlers)
    self.assertEqual(conncheck.ConnCheckManager._spec_handlers['juju'], handler)
    with self.assertRaises(RuntimeError):
        conncheck.ConnCheckManager.register_spec_handler('juju', handler)
def test_register_spec_handler(self):
    self.patch_object(conncheck.ConnCheckManager, '_spec_handlers', name='mock_cls__spec_handlers', new={})

    def handler():
        pass
    conncheck.ConnCheckManager.register_spec_handler('juju', handler)
    self.assertIn('juju', conncheck.ConnCheckManager._spec_handlers)
    self.assertEqual(conncheck.ConnCheckManager._spec_handlers['juju'], handler)
    with self.assertRaises(RuntimeError):
        conncheck.ConnCheckManager.register_spec_handler('juju', handler)