def setUp(self): self.status_response = None # defaults to STATUS_RESPONSE module attribute self.conf = XmlConfigParser() self.conf.loadFromString("""<configuration></configuration>""") self.parser = RavagedParser(self.conf) self.parser.output = Mock() self.parser.output.write = Mock() self.evt_queue = [] def queue_event(evt): self.evt_queue.append(evt) self.queueEvent_patcher = patch.object(self.parser, "queueEvent", wraps=queue_event) self.queueEvent_mock = self.queueEvent_patcher.start() self.parser.startup()
def setUp(self): self.status_response = None # defaults to STATUS_RESPONSE module attribute self.conf = XmlConfigParser() self.conf.loadFromString("""<configuration></configuration>""") self.parser = RavagedParser(self.conf) self.parser.output = Mock() self.parser.output.write = Mock() ADMIN_CONFIG = CfgConfigParser() ADMIN_CONFIG.load(ADMIN_CONFIG_FILE) self.adminPlugin = AdminPlugin(self.parser, ADMIN_CONFIG) when(self.parser).getPlugin("admin").thenReturn(self.adminPlugin) self.adminPlugin.onLoadConfig() self.adminPlugin.onStartup() self.parser.startup()