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()
Esempio n. 2
0
    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)
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)
Esempio n. 5
0
    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")