def setUp(self): self.server = HsmsTestServer() self.client = secsgem.SecsHandler("127.0.0.1", 5000, True, 0, "test", self.server) self.server.start() self.client.enable()
def testStreamFunctionInvalidFunction(self): server = HsmsTestServer() client = secsgem.SecsHandler("127.0.0.1", 5000, False, 0, "test", server) function = client.stream_function(1, 99) self.assertIs(function, None)
def testSecsDecodeNone(self): server = HsmsTestServer() client = secsgem.SecsHandler("127.0.0.1", 5000, False, 0, "test", server) function = client.secs_decode(None) self.assertIsNone(function)
def testSecsDecodeInvalidFunction(self): server = HsmsTestServer() client = secsgem.SecsHandler("127.0.0.1", 5000, False, 0, "test", server) packet = secsgem.HsmsPacket() packet.header.function = 99 function = client.secs_decode(packet) self.assertIsNone(function)
def testSecsDecode(self): server = HsmsTestServer() client = secsgem.SecsHandler("127.0.0.1", 5000, False, 0, "test", server) packet = server.generate_stream_function_packet( 0, secsgem.SecsS01F02(["MDLN", "SOFTREV"])) function = client.secs_decode(packet) self.assertEqual(function.stream, 1) self.assertEqual(function.function, 2) self.assertEqual(function[0], "MDLN") self.assertEqual(function[1], "SOFTREV")