Ejemplo n.º 1
0
 def testUdpServerClose(self):
     ''' test that the synchronous UDP server closes correctly '''
     with patch.object(socket.socket, 'bind') as mock_socket:
         identity = ModbusDeviceIdentification(info={0x00: 'VendorName'})
         server = ModbusUdpServer(context=None, identity=identity)
         server.threads.append(Mock(**{'running': True}))
         server.server_close()
         self.assertEqual(server.control.Identity.VendorName, 'VendorName')
         self.assertFalse(server.threads[0].running)
Ejemplo n.º 2
0
 def testUdpServerClose(self):
     ''' test that the synchronous UDP server closes correctly '''
     with patch.object(socket.socket, 'bind') as mock_socket:
         identity = ModbusDeviceIdentification(info={0x00: 'VendorName'})
         server = ModbusUdpServer(context=None, identity=identity)
         server.threads.append(Mock(**{'running': True}))
         server.server_close()
         self.assertEqual(server.control.Identity.VendorName, 'VendorName')
         self.assertFalse(server.threads[0].running)
Ejemplo n.º 3
0
 def testUdpServerClose(self):
     ''' test that the synchronous UDP server closes correctly '''
     identity = ModbusDeviceIdentification(info={0x00: 'VendorName'})
     server = ModbusUdpServer(context=None,
                              identity=identity,
                              bind_and_activate=False)
     server.server_activate()
     server.threads.append(Mock(**{'running': True}))
     server.server_close()
     self.assertEqual(server.control.Identity.VendorName, 'VendorName')
     self.assertFalse(server.threads[0].running)