Example #1
0
 def test_pingd(self):
     packet = PingD(data='test_data')
     serialized_packet = packet.pack()
     self.socket.sendall(serialized_packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, PongD)
     self.assertEqual(packet.data, reply.data)
Example #2
0
 def test_finish(self):
     packet = Finish().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckFinish)
     self.server.wait(timeout=self.TERMINATE_TIMEOUT)
     self.assertTrue(self.server.poll() is not None)
Example #3
0
 def test_pingd(self):
     packet = PingD(data='test_data')
     serialized_packet = packet.pack()
     self.socket.sendall(serialized_packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, PongD)
     self.assertEqual(packet.data, reply.data)
Example #4
0
 def test_finish(self):
     packet = Finish().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckFinish)
     self.server.wait(timeout=self.TERMINATE_TIMEOUT)
     self.assertTrue(self.server.poll() is not None)
Example #5
0
 def test_finish(self):
     packet = Finish().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckFinish)
     while True:
         if not os.path.exists(self.PID_FILE):
             time.sleep(0.5)
             break
     self.assertTrue(self.server.poll() is not None)
Example #6
0
 def test_quit(self):
     packet = Quit().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckQuit)
     self.assertTrue(hasattr(reply, 'session'))
Example #7
0
 def test_ping(self):
     packet = Ping().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Pong)
Example #8
0
 def test_connect(self):
     packet = Connect().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Connected)
     self.assertTrue(hasattr(reply, 'session'))
Example #9
0
 def test_quit(self):
     packet = Quit().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, AckQuit)
     self.assertTrue(hasattr(reply, 'session'))
Example #10
0
 def test_ping(self):
     packet = Ping().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Pong)
Example #11
0
 def test_connect(self):
     packet = Connect().pack()
     self.socket.sendall(packet)
     reply = Packet.unpack(get_msg(self.socket))
     self.assertIsInstance(reply, Connected)
     self.assertTrue(hasattr(reply, 'session'))