# keep a global reference to the module so we can use it from Event methods
_module = None # type: Optional["Module"]
-# if unit test we want MgrModule to be blank
-if 'UNITTEST' in os.environ:
- MgrModule = object # type: ignore
class Event(object):
"""
# bunch of attributes for testing
module.PgRecoveryEvent.pg_update = mock.Mock()
- self.test_module = module.Module() # so we can see if an event gets created
- self.test_module.log = mock.Mock() # we don't need to log anything
+ module.Module._ceph_get_option = mock.Mock() # .__init__
+ module.Module._configure_logging = lambda *args: ... # .__init__
+ self.test_module = module.Module('module_name', 0, 0) # so we can see if an event gets created
self.test_module.get = mock.Mock() # so we can call pg_update
self.test_module._complete = mock.Mock() # we want just to see if this event gets called
self.test_module.get_osdmap = mock.Mock() # so that self.get_osdmap().get_epoch() works