Esempio n. 1
0
 def test_sendIAmAlive(self):
     self.tr.clear()
     init_alive_count = self.proto.alive_count
     self.factory.alive_loop.clock.advance(self.factory.IAMALIVE_INTERVAL)
     received_element = etree.fromstring(self.tr.value()[4:])
     self.assertEqual("iamalive", received_element.attrib['role'])
     self.assertEqual(DUMMY_SERVICE_IVORN.decode(), received_element.find('Origin').text)
     self.assertEqual(self.proto.alive_count - init_alive_count, 1)
Esempio n. 2
0
 def setUp(self, test_interval=BCAST_TEST_INTERVAL):
     self.factory = VOEventBroadcasterFactory(
         DUMMY_SERVICE_IVORN.decode(), test_interval
     )
     self.factory.alive_loop.clock = task.Clock()
     self.factory.test_loop.clock = task.Clock()
     self.factory.broadcasters.append(DummyBroadcaster())
     self.connector = reactor.listenTCP(0, self.factory)
Esempio n. 3
0
 def setUp(self):
     self.factory = VOEventBroadcasterFactory(
         DUMMY_SERVICE_IVORN.decode(), BCAST_TEST_INTERVAL
     )
     self.factory.alive_loop.clock = task.Clock()
     self.factory.test_loop.clock = task.Clock()
     self.connector = reactor.listenTCP(0, self.factory)
     self.proto = self.factory.buildProtocol(('127.0.0.1', 0))
     self.tr = proto_helpers.StringTransportWithDisconnection()
     self.proto.makeConnection(self.tr)
     self.tr.protocol = self.proto
Esempio n. 4
0
 def test_sent_authenticate(self):
     received_element = etree.fromstring(self.tr.value()[4:])
     self.assertEqual("authenticate", received_element.attrib['role'])
     self.assertEqual(DUMMY_SERVICE_IVORN.decode(), received_element.find('Origin').text)