def test02_named(self): self.createConfig(settings_xml_bots_named) services = pokerbot.makeService(self.filename) factories = [s.args[2] for s in services] self.assertEquals(5, len(factories)) for i, f in enumerate(factories): self.assertEquals('foo%s' % (i+1), f.name) self.assertEquals('bar%s' % (i+1), f.password) factories[0].reconnect = True factories[0].went_broke = True d = defer.Deferred() class DummyConnector: def connect(self): d.callback(None) factories[0].clientConnectionLost(DummyConnector(), 'reason') self.assertEquals('foo1', factories[0].name) return d
def test02_named(self): self.createConfig(settings_xml_bots_named) services = pokerbot.makeService(self.filename) factories = [s.args[2] for s in services] self.assertEquals(5, len(factories)) for i, f in enumerate(factories): self.assertEquals('foo%s' % (i + 1), f.name) self.assertEquals('bar%s' % (i + 1), f.password) factories[0].reconnect = True factories[0].went_broke = True d = defer.Deferred() class DummyConnector: def connect(self): d.callback(None) factories[0].clientConnectionLost(DummyConnector(), 'reason') self.assertEquals('foo1', factories[0].name) return d
def makeService(self, options): return pokerbot.makeService(options["config"])
def test01_generated(self): self.createConfig(settings_xml_bots_generated) services = pokerbot.makeService(self.filename) self.assertEquals(8, len([s for s in services]))