Ejemplo n.º 1
0
    def setUp(self):
        self.status_response = None  # defaults to STATUS_RESPONSE module attribute
        self.conf = XmlConfigParser()
        self.conf.loadFromString("""<configuration></configuration>""")
        self.parser = InsurgencyParser(self.conf)
        self.parser.output = Mock()
        self.parser.output.write = Mock(wraps=self.output_write)
        when(self.parser).is_sourcemod_installed().thenReturn(True)
        when(self.parser).getMap().thenReturn('buhriz')

        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()
Ejemplo n.º 2
0
 def setUp(self):
     self.status_response = None  # defaults to STATUS_RESPONSE module attribute
     self.conf = XmlConfigParser()
     self.conf.loadFromString("""<configuration></configuration>""")
     self.parser = InsurgencyParser(self.conf)
     self.parser.output = Mock()
     self.parser.output.write = Mock(wraps=sys.stdout.write)
     when(self.parser).is_sourcemod_installed().thenReturn(True)
     adminPlugin_conf = CfgConfigParser()
     adminPlugin_conf.load(ADMIN_CONFIG_FILE)
     adminPlugin = AdminPlugin(self.parser, adminPlugin_conf)
     adminPlugin.onLoadConfig()
     adminPlugin.onStartup()
     when(self.parser).getPlugin('admin').thenReturn(adminPlugin)
     when(self.parser).getAllAvailableMaps().thenReturn([
         'buhriz', 'district', 'sinjar', 'siege', 'uprising', 'ministry',
         'revolt', 'heights', 'contact', 'peak', 'panj', 'market'
     ])
     when(self.parser).getMap().thenReturn('buhriz')
     self.parser.startup()
     self.parser.patch_b3_admin_plugin(
     )  # seems that without this the test module doesn't patch the admin plugin