def afterSetUp(self):
        super(TestPublishModelChanges, self).afterSetUp()

        self.publisher = getModelChangePublisher()
        from zope.component import getGlobalSiteManager
        # register the component
        gsm = getGlobalSiteManager()
        queue = DummyQueuePublisher()
        gsm.registerUtility(queue, IQueuePublisher)
        self.queue = queue
        # create a dummy device
        self.device = self.dmd.Devices.createInstance('testDevice')
        self.publisher.publishAdd(self.device)
Example #2
0
 def afterSetUp(self):
     super(TestZenHub, self).afterSetUp()
     global count
     count += 1
     base = self.base + count
     xbase = self.xbase + count
     self.before, sys.argv = sys.argv, [
         'run',
         '--pbport=%d' % base,
         '--xmlrpcport=%d' % xbase, '--workers=0'
     ]
     self.zenhub = ZenHub()
     from zope.component import getGlobalSiteManager
     # The call to zenhub above overrides the queue so we need to
     # re-override it
     gsm = getGlobalSiteManager()
     queue = DummyQueuePublisher()
     gsm.registerUtility(queue, IQueuePublisher)
Example #3
0
 def testSendEvent(self):
     EventPublisher._publisher = DummyQueuePublisher()
     client = SendEventClient(self, self.base + count)
     self.assertFalse(client.success)
     self.zenhub.main()
     self.assertTrue(client.success)
Example #4
0
 def testUsingPublisher(self):
     event = self._createDummyEvent()
     publisher = EventPublisher()
     EventPublisher._publisher = DummyQueuePublisher()
     publisher.publish(event)
     EventPublisher._publisher = None