Esempio n. 1
0
 def testParent(self):
     parent = app.MultiService("test")
     auth = authorizer.Authorizer(parent)
     s = service.Service("test service", parent, authorizer=auth)
     self.assertEqual(s.authorizer.getServiceNamed(s.getServiceName()),
                      s)
     parent2 = app.MultiService("test")
     s.disownServiceParent()
     s.setServiceParent(parent2)
     self.assertEqual(s.authorizer.getServiceNamed(s.getServiceName()),
                      s)
Esempio n. 2
0
 def testConstruction(self):
     appl = self.App("test app for service-test")
     auth = authorizer.Authorizer()
     parent = app.MultiService("test")
     service.Service("test service")
     service.Service("test service", authorizer=auth)
     service.Service("test service", parent)
Esempio n. 3
0
 def testDeferredStopService(self):
     ms = app.MultiService("MultiService")
     self.s1 = StoppingService("testService", 0)
     self.s2 = StoppingService("testService2", 1)
     ms.addService(self.s1)
     ms.addService(self.s2)
     ms.stopService().addCallback(self.woohoo)
     log.flushErrors(StopError)
Esempio n. 4
0
 def testStopServiceNone(self):
     """MultiService.stopService returns Deferred when service returns None.
     """
     ms = app.MultiService("MultiService")
     self.s1 = StoppingServiceII("testService")
     ms.addService(self.s1)
     d = ms.stopService()
     d.addCallback(self.cb_nonetest)
     log.flushErrors(StopError)
Esempio n. 5
0
 def testEmptyStopService(self):
     """MutliService.stopService returns Deferred when empty."""
     ms = app.MultiService("MultiService")
     d = ms.stopService()
     d.addCallback(self.cb_emptytest)
Esempio n. 6
0
 def testsetServiceParent(self):
     parent = app.MultiService("test")
     self.service.setServiceParent(parent)
     self.assert_(self.service.serviceParent is parent)
 def testOldApplication(self):
     from twisted.internet import app as oapp
     application = oapp.Application("HELLO")
     oapp.MultiService("HELLO", application)
     compat.convert(application)