def testLoad(self): xeml = XmlEventManagerLoader() em = EventManager() xeml.load('resource/sample.xml', em) em.push(BanEvent()) try: em.push(KickEvent()) except Exception: pass else: self.fail("expected an exception from ExceptionListener")
def testInjection(self): f = open('scrutator/tests/tool.fakepy', 'r') content = f.read() bus = EventManager() bus.bind(FileContent().getType(),FileContentListener()) #bus.bind('all',PrintListener()) bus.push(FileContent(filename="hello/world/nimp/__init__.py",content="print \"init\"")) bus.push(FileContent(filename="fake/__init__.py",content="print \"init\"")) bus.push(FileContent(filename="fake/fake.py",content=content)) bus.push(DieEvent(test="hello")) import fake.fake