def __init__(self): self.global_cmd_table = GlobalCommandTable() self.global_admin_cmd_table = GlobalAdminCommandTable() self.command_handler = CommandHandler(self) self.session_manager = SessionManager(self) self.object_store = ObjectStore(self, db_mode='test') self.account_store = AccountStore(db_mode='test') self.proxyamp = FakeProxyAMP()
class MockMudService(object): """ Mocks up the MudService class found in dott.tac. """ #noinspection PyTypeChecker def __init__(self): self.global_cmd_table = GlobalCommandTable() self.global_admin_cmd_table = GlobalAdminCommandTable() self.command_handler = CommandHandler(self) self.session_manager = SessionManager(self) self.object_store = ObjectStore(self, db_mode='test') self.account_store = AccountStore(db_mode='test') self.proxyamp = FakeProxyAMP() @inlineCallbacks def prep_and_load(self): """ Gets the various stores and other stuff set up and loaded from the DB. """ yield self.object_store.prep_and_load() yield self.account_store.prep_and_load() #noinspection PyProtectedMember @inlineCallbacks def unload(self): """ Right now this is specific to unit tests, and doesn't actually exist in the actual MudService class. We clear out the various test tables and close all DB pointers. """ yield self.object_store.db_manager._db.runOperation( "TRUNCATE dott_accounts, dott_objects") self.object_store.db_manager._db.close() self.account_store.db_manager._db.close()