def subscribeCollectionEvent(self, ceid, dvs, report_id): clientCommandThread = threading.Thread( target=self.client.subscribe_collection_event, args=(ceid, dvs, report_id), name="TestGemHostHandlerPassive_subscribeCollectionEvent") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=33) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F34(secsgem.DRACK.ACK)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=35) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F36(secsgem.LRACK.ACK)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=37) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F38(secsgem.ERACK.ACCEPTED)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())
def testDisableCeids(self): self.server.simulate_connect() self.performSelect() clientCommandThread = threading.Thread( target=self.client.disable_ceids, name="TestSecsHandlerPassive_testDisableCeids") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=37) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 37) function = self.client.secs_decode(packet) self.assertEqual(function["CEED"], False) self.assertEqual(function["CEID"].get(), []) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F38(secsgem.ERACK.ACCEPTED)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())
def testClearCollectionEvents(self): self.establishCommunication() clientCommandThread = threading.Thread( target=self.client.clear_collection_events, name="TestGemHostHandlerPassive_testClearCollectionEvents") clientCommandThread.daemon = True # make thread killable on program termination clientCommandThread.start() packet = self.server.expect_packet(function=37) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 37) function = self.client.secs_decode(packet) self.assertEqual(function["CEED"], False) self.assertEqual(function["CEID"].get(), []) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F38(secsgem.ERACK.ACCEPTED)) self.server.simulate_packet(packet) packet = self.server.expect_packet(function=33) self.assertIsNot(packet, None) self.assertEqual(packet.header.sType, 0x00) self.assertEqual(packet.header.sessionID, 0x0) self.assertEqual(packet.header.stream, 2) self.assertEqual(packet.header.function, 33) function = self.client.secs_decode(packet) self.assertEqual(function["DATAID"], 0) self.assertEqual(function["DATA"].get(), []) packet = self.server.generate_stream_function_packet( packet.header.system, secsgem.SecsS02F34(secsgem.DRACK.ACK)) self.server.simulate_packet(packet) clientCommandThread.join(1) self.assertFalse(clientCommandThread.isAlive())